aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc/c-opts.c
diff options
context:
space:
mode:
authorDavid Schultz <das@FreeBSD.org>2009-03-14 19:36:13 +0000
committerDavid Schultz <das@FreeBSD.org>2009-03-14 19:36:13 +0000
commitd5ed956300dfb1a270db88bc577a22a505635072 (patch)
treec558b410b306a19744a89a59566a13b06e62050e /contrib/gcc/c-opts.c
parent34d3ac5921afaf71434385a6b0c2753ab4d95085 (diff)
downloadsrc-d5ed956300dfb1a270db88bc577a22a505635072.tar.gz
src-d5ed956300dfb1a270db88bc577a22a505635072.zip
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@
Notes
Notes: svn path=/head/; revision=189824
Diffstat (limited to 'contrib/gcc/c-opts.c')
-rw-r--r--contrib/gcc/c-opts.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/gcc/c-opts.c b/contrib/gcc/c-opts.c
index d27959f2c9e6..3e89ec290201 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. */