diff options
author | das <das@FreeBSD.org> | 2009-03-14 19:36:13 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2009-03-14 19:36:13 +0000 |
commit | c7efb5498d33bf2d06b809dd5562d0b0f786c54f (patch) | |
tree | c558b410b306a19744a89a59566a13b06e62050e /contrib/gcc/c-opts.c | |
parent | 32a758b56941b6e90a12494c1b354b5155bd5643 (diff) | |
download | FreeBSD-src-c7efb5498d33bf2d06b809dd5562d0b0f786c54f.zip FreeBSD-src-c7efb5498d33bf2d06b809dd5562d0b0f786c54f.tar.gz |
Make gcc use C99 inline semantics in c99 and gnu99 mode. This was the
original intent, but the functionality wasn't implemented until after
gcc 4.2 was released. However, if you compiled a program that would
behave differently before and after this change, gcc 4.2 would have
warned you; hence, everything currently in the base system is
unaffected by this change. This patch also adds additional warnings
about certain inline function-related bogosity, e.g., using a
static non-const local variable in an inline function.
These changes were merged from a snapshot of gcc mainline from March
2007, prior to the GPLv3 switch. I then ran the regression test suite
from a more recent gcc snapshot and fixed the important bugs it found.
I also squelched the following warning unless -pedantic is specified:
foo is static but used in inline function bar which is not static
This is consistent with LLVM's behavior, but not consistent with gcc 4.3.
Reviewed by: arch@
Diffstat (limited to 'contrib/gcc/c-opts.c')
-rw-r--r-- | contrib/gcc/c-opts.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/gcc/c-opts.c b/contrib/gcc/c-opts.c index d27959f..3e89ec2 100644 --- a/contrib/gcc/c-opts.c +++ b/contrib/gcc/c-opts.c @@ -21,6 +21,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* $FreeBSD$ */ +/* Merged C99 inline changes from gcc trunk 122565 2007-03-05 */ #include "config.h" #include "system.h" @@ -1008,11 +1009,12 @@ c_common_post_options (const char **pfilename) if (flag_inline_functions) flag_inline_trees = 2; - /* We recognize -fgnu89-inline in preparation for 4.3 where the - option will be meaningful. Here we just reject - -fno-gnu89-inline, since we don't support it. */ - if (!flag_gnu89_inline) - error ("-fno-gnu89-inline is not supported"); + /* By default we use C99 inline semantics in GNU99 or C99 mode. C99 + inline semantics are not supported in GNU89 or C89 mode. */ + if (flag_gnu89_inline == -1) + flag_gnu89_inline = !flag_isoc99; + else if (!flag_gnu89_inline && !flag_isoc99) + error ("-fno-gnu89-inline is only supported in GNU99 or C99 mode"); /* If we are given more than one input file, we must use unit-at-a-time mode. */ |