Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Aug 2015 18:55:32 +0200
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        svn-src-all@freebsd.org
Subject:   Re: svn commit: r287217 - head/usr.sbin/syslogd
Message-ID:  <20150830165532.GB7574@britannica.bec.de>
In-Reply-To: <20150830151625.K1159@besplex.bde.org>
References:  <201508271811.t7RIB0xl077002@repo.freebsd.org> <20150828215109.G1227@besplex.bde.org> <20150828143847.GA24222@britannica.bec.de> <20150830151625.K1159@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 30, 2015 at 03:36:27PM +1000, Bruce Evans wrote:
> On Fri, 28 Aug 2015, Joerg Sonnenberger wrote:
> 
> >On Fri, Aug 28, 2015 at 10:17:56PM +1000, Bruce Evans wrote:
> >>>-static void	die(int);
> >>>+static void	die(int) __dead2;
> >>
> >>Since the function is static, it is very easy for the compiler to see
> >>that it doesn't return.
> >
> >But the compiler can't tell if it is the *intention* that the function
> >never returns. The warning behavior exists because that can easily
> >change with macros etc.
> 
> The compiler should trust the programmer to write correct functions.

That's a good one. Programmers are notorious for one thing, which is not
writing correct code.

> >>Even gcc-4.2.1 does this by default, since
> >>-O implies -funit-at-a-time for gcc-4.2.1.  For clang, there is no way
> >>to prevent this (except possibly -O0) since, since -fno-unit-at-a-time
> >>is broken in clang.
> >
> >It is not broken. It is loadly ignored as unsupported. The very
> >existance of the option in GCC has always been a concession to broken
> >and badly written code, including of course GCC's own CRT.
> 
> Unsupported == incompatible == broken.
> 
> My use of this option can probably be reduced to -fno-toplevel-reorder,
> but that is even more broken in clang (it and -ftoplevel-reorder are
> "unknown arguments", while -fno-unit-at-a-time is an "unsupported
> optimization", and -funit-at-a-time works).

Neither -fno-unit-at-a-time nor -funit-at-a-time is an optimisation.
Nothing in the standard suggests a specific ordering and well written
programs don't make such assumptions. All use cases I have seen so far
are miswritten and fragile and would be better served by using a
different approach. This is no different from broken code requiring
function calls in a sequence point to be executed in a specific order.

Joerg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150830165532.GB7574>