aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2002-08-07 18:32:13 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-08-07 18:32:13 +0000
commit0b6f2917cfcbfbaccca804e0f038ac8c4457f772 (patch)
treef482610e2d7395c411d78c8b0b4b49417cca0344 /gcc/c-decl.c
parente49ec17d553e4c1e5c3a18a6bb15627959c5a313 (diff)
downloadgcc-0b6f2917cfcbfbaccca804e0f038ac8c4457f772.zip
gcc-0b6f2917cfcbfbaccca804e0f038ac8c4457f772.tar.gz
gcc-0b6f2917cfcbfbaccca804e0f038ac8c4457f772.tar.bz2
Makefile.in (c-opts.o, [...]): Update.
* Makefile.in (c-opts.o, c-common.o, C_AND_OBJC_OBJS): Update. * c-common.c: Don't include tree-inline.h. (c_common_init_options, c_common_post_options): Move to c-opts.c. * c-common.h (c_common_decode_option): New. * c-decl.c (c_decode_option): Remove. * c-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option. * c-opts.c: New file. * c-tree.h (c_decode_option): Remove. * doc/passes.texi: Update. * objc/objc-act.c (objc_decode_option): Remove. * objc/objc-act.h (objc_decode_option): Remove. * objc/ojbc-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option. cp: * Make-lang.in (CXX_C_OBJS): Update. * cp-lang.c (LANG_HOOKS_DECODE_OPTION): Use c_common_decode_option. * cp-tree.h (cxx_decode_option): Remove. * decl2.c (compare_options, lang_f_options, unsupported_options, cxx_decode_option): Remove. testsuite: * objc.dg/const-str-2.m: Update. * gcc.dg/cpp/c++98.c: Change to C extension. * gcc.dg/cpp/c++98-pedantic.c: Similarly. * gcc.dg/cpp/cpp.exp: Process .C extensions too. From-SVN: r56105
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c262
1 files changed, 0 insertions, 262 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 4adbe69..7344292 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -295,268 +295,6 @@ enum deprecated_states {
static enum deprecated_states deprecated_state = DEPRECATED_NORMAL;
-/* Decode the string P as a language-specific option for C.
- Return the number of strings consumed. Should not complain
- if it does not recognise the option. */
-
-int
-c_decode_option (argc, argv)
- int argc ATTRIBUTE_UNUSED;
- char **argv;
-{
- int strings_processed;
- char *p = argv[0];
-
- static const struct {
- /* The name of the option. */
- const char *option;
- /* A pointer to a flag variable to set to 0 or 1. */
- int *flag;
- } warn_options[] = {
- /* This list is in alphabetical order. Keep it like that. */
- { "bad-function-cast", &warn_bad_function_cast },
- { "cast-qual", &warn_cast_qual },
- { "char-subscripts", &warn_char_subscripts },
- { "conversion", &warn_conversion },
- { "div-by-zero", &warn_div_by_zero },
- { "float-equal", &warn_float_equal },
- { "format-extra-args", &warn_format_extra_args },
- { "format-zero-length", &warn_format_zero_length },
- { "format-nonliteral", &warn_format_nonliteral },
- { "format-security", &warn_format_security },
- { "format-y2k", &warn_format_y2k },
- { "implicit-function-declaration", &mesg_implicit_function_declaration },
- { "implicit-int", &warn_implicit_int },
- { "long-long", &warn_long_long },
- { "main", &warn_main },
- { "missing-braces", &warn_missing_braces },
- { "missing-declarations", &warn_missing_declarations },
- { "missing-format-attribute", &warn_missing_format_attribute },
- { "missing-prototypes", &warn_missing_prototypes },
- { "multichar", &warn_multichar },
- { "nested-externs", &warn_nested_externs },
- { "nonnull", &warn_nonnull },
- { "parentheses", &warn_parentheses },
- { "pointer-arith", &warn_pointer_arith },
- { "redundant-decls", &warn_redundant_decls },
- { "return-type", &warn_return_type },
- { "sequence-point", &warn_sequence_point },
- { "sign-compare", &warn_sign_compare },
- { "strict-prototypes", &warn_strict_prototypes },
- { "traditional", &warn_traditional },
- { "write-strings", &flag_const_strings }
- };
-
- strings_processed = cpp_handle_option (parse_in, argc, argv);
-
- if (!strcmp (p, "-fhosted") || !strcmp (p, "-fno-freestanding"))
- {
- flag_hosted = 1;
- flag_no_builtin = 0;
- }
- else if (!strcmp (p, "-ffreestanding") || !strcmp (p, "-fno-hosted"))
- {
- flag_hosted = 0;
- flag_no_builtin = 1;
- /* warn_main will be 2 if set by -Wall, 1 if set by -Wmain */
- if (warn_main == 2)
- warn_main = 0;
- }
- else if (!strncmp (p, "-std=", 5))
- {
- /* Select the appropriate language standard. We currently
- recognize:
- -std=iso9899:1990 same as -ansi
- -std=iso9899:199409 ISO C as modified in amend. 1
- -std=iso9899:1999 ISO C 99
- -std=c89 same as -std=iso9899:1990
- -std=c99 same as -std=iso9899:1999
- -std=gnu89 default, iso9899:1990 + gnu extensions
- -std=gnu99 iso9899:1999 + gnu extensions
- */
- const char *const argstart = &p[5];
-
- if (!strcmp (argstart, "iso9899:1990")
- || !strcmp (argstart, "c89"))
- {
- iso_1990:
- flag_isoc94 = 0;
- iso_1994:
- flag_writable_strings = 0;
- flag_no_asm = 1;
- flag_no_nonansi_builtin = 1;
- flag_noniso_default_format_attributes = 0;
- flag_isoc99 = 0;
- flag_iso = 1;
- }
- else if (!strcmp (argstart, "iso9899:199409"))
- {
- flag_isoc94 = 1;
- goto iso_1994;
- }
- else if (!strcmp (argstart, "iso9899:199x")
- || !strcmp (argstart, "iso9899:1999")
- || !strcmp (argstart, "c9x")
- || !strcmp (argstart, "c99"))
- {
- flag_writable_strings = 0;
- flag_no_asm = 1;
- flag_no_nonansi_builtin = 1;
- flag_noniso_default_format_attributes = 0;
- flag_isoc99 = 1;
- flag_isoc94 = 1;
- flag_iso = 1;
- }
- else if (!strcmp (argstart, "gnu89"))
- {
- flag_writable_strings = 0;
- flag_no_asm = 0;
- flag_no_nonansi_builtin = 0;
- flag_noniso_default_format_attributes = 1;
- flag_isoc99 = 0;
- flag_isoc94 = 0;
- }
- else if (!strcmp (argstart, "gnu9x") || !strcmp (argstart, "gnu99"))
- {
- flag_writable_strings = 0;
- flag_no_asm = 0;
- flag_no_nonansi_builtin = 0;
- flag_noniso_default_format_attributes = 1;
- flag_isoc99 = 1;
- flag_isoc94 = 1;
- }
- else if (!strcmp (argstart, "c++98"))
- ; /* Handled by cpplib. */
- else
- error ("unknown C standard `%s'", argstart);
- }
- else if (!strcmp (p, "-fdollars-in-identifiers"))
- dollars_in_ident = 1;
- else if (!strcmp (p, "-fno-dollars-in-identifiers"))
- dollars_in_ident = 0;
- else if (!strcmp (p, "-fsigned-char"))
- flag_signed_char = 1;
- else if (!strcmp (p, "-funsigned-char"))
- flag_signed_char = 0;
- else if (!strcmp (p, "-fno-signed-char"))
- flag_signed_char = 0;
- else if (!strcmp (p, "-fno-unsigned-char"))
- flag_signed_char = 1;
- else if (!strcmp (p, "-fsigned-bitfields")
- || !strcmp (p, "-fno-unsigned-bitfields"))
- {
- flag_signed_bitfields = 1;
- explicit_flag_signed_bitfields = 1;
- }
- else if (!strcmp (p, "-funsigned-bitfields")
- || !strcmp (p, "-fno-signed-bitfields"))
- {
- flag_signed_bitfields = 0;
- explicit_flag_signed_bitfields = 1;
- }
- else if (!strcmp (p, "-fshort-enums"))
- flag_short_enums = 1;
- else if (!strcmp (p, "-fno-short-enums"))
- flag_short_enums = 0;
- else if (!strcmp (p, "-fshort-wchar"))
- flag_short_wchar = 1;
- else if (!strcmp (p, "-fno-short-wchar"))
- flag_short_wchar = 0;
- else if (!strcmp (p, "-fcond-mismatch"))
- flag_cond_mismatch = 1;
- else if (!strcmp (p, "-fno-cond-mismatch"))
- flag_cond_mismatch = 0;
- else if (!strcmp (p, "-fshort-double"))
- flag_short_double = 1;
- else if (!strcmp (p, "-fno-short-double"))
- flag_short_double = 0;
- else if (!strcmp (p, "-fasm"))
- flag_no_asm = 0;
- else if (!strcmp (p, "-fno-asm"))
- flag_no_asm = 1;
- else if (!strcmp (p, "-fms-extensions"))
- flag_ms_extensions = 1;
- else if (!strcmp (p, "-fno-ms-extensions"))
- flag_ms_extensions = 0;
- else if (!strcmp (p, "-fbuiltin"))
- flag_no_builtin = 0;
- else if (!strcmp (p, "-fno-builtin"))
- flag_no_builtin = 1;
- else if (!strncmp (p, "-fno-builtin-", strlen ("-fno-builtin-")))
- disable_builtin_function (p + strlen ("-fno-builtin-"));
- else if (p[0] == '-' && p[1] == 'f' && dump_switch_p (p + 2))
- ;
- else if (!strcmp (p, "-ansi"))
- goto iso_1990;
- else if (!strcmp (p, "-undef"))
- flag_undef = 1;
- else if (!strcmp (p, "-Werror-implicit-function-declaration"))
- mesg_implicit_function_declaration = 2;
- else if (!strncmp (p, "-Wformat=", 9))
- set_Wformat (atoi (p + 9));
- else if (!strcmp (p, "-Wformat"))
- set_Wformat (1);
- else if (!strcmp (p, "-Wno-format"))
- set_Wformat (0);
- else if (!strcmp (p, "-Wimplicit"))
- {
- warn_implicit_int = 1;
- if (mesg_implicit_function_declaration != 2)
- mesg_implicit_function_declaration = 1;
- }
- else if (!strcmp (p, "-Wno-implicit"))
- warn_implicit_int = 0, mesg_implicit_function_declaration = 0;
- else if (!strcmp (p, "-Wno-main"))
- warn_main = -1;
- else if (!strcmp (p, "-Wunknown-pragmas"))
- /* Set to greater than 1, so that even unknown pragmas in system
- headers will be warned about. */
- warn_unknown_pragmas = 2;
- else if (!strcmp (p, "-Wno-unknown-pragmas"))
- warn_unknown_pragmas = 0;
- else if (!strcmp (p, "-Wall"))
- {
- /* We save the value of warn_uninitialized, since if they put
- -Wuninitialized on the command line, we need to generate a
- warning about not using it without also specifying -O. */
- if (warn_uninitialized != 1)
- warn_uninitialized = 2;
- warn_implicit_int = 1;
- mesg_implicit_function_declaration = 1;
- warn_return_type = 1;
- set_Wunused (1);
- warn_switch = 1;
- set_Wformat (1);
- warn_char_subscripts = 1;
- warn_parentheses = 1;
- warn_sequence_point = 1;
- warn_missing_braces = 1;
- /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn
- it off only if it's not explicit. */
- warn_main = 2;
- /* Only warn about unknown pragmas that are not in system headers. */
- warn_unknown_pragmas = 1;
- }
- else if (!strcmp (p, "-E"))
- flag_preprocess_only = 1;
- else
- {
- size_t i;
- for (i = 0; i < ARRAY_SIZE (warn_options); i++)
- if (strncmp (p, "-W", 2) == 0
- && (strcmp (p+2, warn_options[i].option) == 0
- || (strncmp (p+2, "no-", 3) == 0
- && strcmp (p+5, warn_options[i].option) == 0)))
- {
- *(warn_options[i].flag) = strncmp (p+2, "no-", 3) != 0;
- return 1;
- }
- return strings_processed;
- }
-
- return 1;
-}
-
void
c_print_identifier (file, node, indent)
FILE *file;