aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorPhil Edwards <pme@gcc.gnu.org>2002-03-22 21:59:04 +0000
committerPhil Edwards <pme@gcc.gnu.org>2002-03-22 21:59:04 +0000
commit909de5da19288f60ab09dbe6165399d3f833a692 (patch)
treed57dbbd51916727143458d291e8952b43c8151c0 /gcc/cppinit.c
parent4299b4e14e26a0c74563843b627ff707d7be0406 (diff)
downloadgcc-909de5da19288f60ab09dbe6165399d3f833a692.zip
gcc-909de5da19288f60ab09dbe6165399d3f833a692.tar.gz
gcc-909de5da19288f60ab09dbe6165399d3f833a692.tar.bz2
cpplib.h (struct cpp_options): New member, warn_endif_labels.
2002-03-22 Phil Edwards <pme@gcc.gnu.org> * cpplib.h (struct cpp_options): New member, warn_endif_labels. * cppinit.c (cpp_create_reader): On by default. (cpp_handle_option): Handle -W[no-]endif-labels. (cpp_post_options): Also enable if -pedantic. * cpplib.c (do_else): Use it. (do_endif): Likewise. * doc/cppopts.texi: Document new option. * doc/invoke.texi: Document new option. From-SVN: r51190
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index ae9416e..d3d59ef 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -491,6 +491,7 @@ cpp_create_reader (lang)
CPP_OPTION (pfile, show_column) = 1;
CPP_OPTION (pfile, tabstop) = 8;
CPP_OPTION (pfile, operator_names) = 1;
+ CPP_OPTION (pfile, warn_endif_labels) = 1;
#if DEFAULT_SIGNED_CHAR
CPP_OPTION (pfile, signed_char) = 1;
#else
@@ -1735,6 +1736,8 @@ cpp_handle_option (pfile, argc, argv, ignore)
CPP_OPTION (pfile, warnings_are_errors) = 1;
else if (!strcmp (argv[i], "-Wsystem-headers"))
CPP_OPTION (pfile, warn_system_headers) = 1;
+ else if (!strcmp (argv[i], "-Wendif-labels"))
+ CPP_OPTION (pfile, warn_endif_labels) = 1;
else if (!strcmp (argv[i], "-Wno-traditional"))
CPP_OPTION (pfile, warn_traditional) = 0;
else if (!strcmp (argv[i], "-Wno-trigraphs"))
@@ -1751,6 +1754,8 @@ cpp_handle_option (pfile, argc, argv, ignore)
CPP_OPTION (pfile, warnings_are_errors) = 0;
else if (!strcmp (argv[i], "-Wno-system-headers"))
CPP_OPTION (pfile, warn_system_headers) = 0;
+ else if (!strcmp (argv[i], "-Wno-endif-labels"))
+ CPP_OPTION (pfile, warn_endif_labels) = 0;
else if (! ignore)
return i;
break;
@@ -1832,6 +1837,10 @@ cpp_post_options (pfile)
|| CPP_OPTION (pfile, deps_file)
|| CPP_OPTION (pfile, deps_phony_targets)))
cpp_fatal (pfile, "you must additionally specify either -M or -MM");
+
+ /* Some things should always be on in pedantic mode. */
+ if (CPP_OPTION (pfile, pedantic) == 1)
+ CPP_OPTION (pfile, warn_endif_labels) = 1;
}
/* Set up dependency-file output. On exit, if print_deps is non-zero