Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jun 2018 16:54:43 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Eitan Adler <eadler@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r335278 - head/bin/pwd
Message-ID:  <20180617161907.Y1464@besplex.bde.org>
In-Reply-To: <201806170514.w5H5Epts050842@repo.freebsd.org>
References:  <201806170514.w5H5Epts050842@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 17 Jun 2018, Eitan Adler wrote:

> Log:
>  pwd: mark usage as dead
>
> Modified:
>  head/bin/pwd/pwd.c
>
> Modified: head/bin/pwd/pwd.c
> ==============================================================================
> --- head/bin/pwd/pwd.c	Sun Jun 17 03:33:29 2018	(r335277)
> +++ head/bin/pwd/pwd.c	Sun Jun 17 05:14:50 2018	(r335278)
> @@ -95,7 +95,7 @@ main(int argc, char *argv[])
> 	exit(0);
> }
>
> -void
> +void __dead2
> usage(void)
> {

I asked you to back out a previous addition of __dead2 about 20 additions
of it ago.

__dead2 here has no effect.  The compiler can see that usage() doesn't
return if it understands __dead2 at all, since usage() ends with exit()
which is declared as __dead2.

If __dead2 were added in a place where the addition is not complete
nonsense, that is in the forward declaration of the function, then it
would have an effect in compilers that don't implement -funit-at-a-time.
Then since usage() is called before it is defined, compilers that don't
parse the whole file before generating any code would have to consider
the function as possibly returning for some of the calls to it unless
the forward declaration tells them otherwise.  However, -funit-at-a-time
can't even be turned off for clang.  -funit-at-time is merely the
default for gcc starting with -O2, and can be turned off.  Detecting
functions that don't return is a trivial part of inlining.

See my old mail about this for more details.

Bruce



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