diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-01 21:05:17 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-12-01 21:05:17 +0000 |
commit | 75bd5adae1072ec96f2b05f35147891f977ab2b2 (patch) | |
tree | 8180a32dab64f00b8c46fedcdc5e7b9928102158 /gcc/c-decl.c | |
parent | c50a498ccf40a4f355b138f6e51e500095895ba0 (diff) | |
download | gcc-75bd5adae1072ec96f2b05f35147891f977ab2b2.tar.gz |
* c-common.c (declare_function_name): Declare predefinied variable
`__func__'.
* c-decl.c (flag_isoc9x): Set to 1 by default.
(c_decode_option): Handle -std= option. Remove -flang-isoc9x.
(grokdeclarator): Always emit warning about implicit int for ISO C 9x.
* c-parse.in: Allow constructors in ISO C 9x.
Rewrite designator list handling.
Allow [*] parameters.
Don't warn about comma at end of enum definition for ISO C 9x.
* cccp.c (c9x): New variable.
(rest_extension): New variable.
(print_help): Document new -std= option.
(main): Recognize -std= option. Set c9x appropriately.
(create_definition): Recognize ISO C 9x vararg macros.
* gcc.c (default_compilers): Adjust specs for -std options.
(option_map): Add --std.
(display_help): Document -std.
* toplev.c (documented_lang_options): Add -std and remove
-flang-isoc9x.
* c-lex.c (yylex): Recognize hex FP constants and call REAL_VALUE_ATOF
or REAL_VALUE_HTOF based on base of the constants.
* fold-const.c (real_hex_to_f): New function. Replacement function
for hex FP conversion if REAL_ARITHMETIC is not defined.
* real.c (asctoeg): Add handling of hex FP constants.
* real.h: Define REAL_VALUE_HTOF if necessary using ereal_atof or
real_hex_to_f.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 91e35104a11..c0898363642 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -470,7 +470,7 @@ int flag_traditional; /* Nonzero means use the ISO C9x dialect of C. */ -int flag_isoc9x = 0; +int flag_isoc9x = 1; /* Nonzero means that we have builtin functions, and main is an int */ @@ -652,8 +652,54 @@ c_decode_option (argc, argv) flag_traditional = 0; flag_writable_strings = 0; } - else if (!strcmp (p, "-flang-isoc9x")) - flag_isoc9x = 1; + else if (!strncmp (p, "-std=", 5)) + { + /* Select the appropriate language standard. We currently + recognize: + -std=iso9899:1990 same as -ansi + -std=gnu default + -std=iso9899:199409 ISO C as modified in amend. 1 + -std=iso9899:199x ISO C 9x + -std=c89 same as -std=iso9899:1990 + -std=c9x same as -std=iso9899:199x + */ + const char *argstart = &p[5]; + + if (!strcmp (argstart, "iso9899:1990") + || !strcmp (argstart, "c89")) + { + iso_1990: + flag_traditional = 0; + flag_writable_strings = 0; + flag_no_asm = 1; + flag_no_nonansi_builtin = 1; + flag_isoc9x = 0; + } + else if (!strcmp (argstart, "iso9899:199409")) + { + /* ??? The changes since ISO C 1990 are not supported. */ + goto iso_1990; + } + else if (!strcmp (argstart, "iso9899:199x") + || !strcmp (argstart, "c9x")) + { + flag_traditional = 0; + flag_writable_strings = 0; + flag_no_asm = 1; + flag_no_nonansi_builtin = 1; + flag_isoc9x = 1; + } + else if (!strcmp (argstart, "gnu")) + { + flag_traditional = 0; + flag_writable_strings = 0; + flag_no_asm = 0; + flag_no_nonansi_builtin = 0; + flag_isoc9x = 1; + } + 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")) @@ -703,7 +749,7 @@ c_decode_option (argc, argv) else if (!strcmp (p, "-fident")) flag_no_ident = 0; else if (!strcmp (p, "-ansi")) - flag_no_asm = 1, flag_no_nonansi_builtin = 1; + goto iso_1990; else if (!strcmp (p, "-Werror-implicit-function-declaration")) mesg_implicit_function_declaration = 2; else if (!strcmp (p, "-Wimplicit-function-declaration")) @@ -4492,13 +4538,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) && ! (specbits & (1 << (int) RID_TYPEDEF) && initialized) && ! (in_system_header && ! allocation_temporary_p ())) { - /* C9x will probably require a diagnostic here. - For now, issue a warning if -Wreturn-type and this is a function, - or if -Wimplicit; prefer the former warning since it is more - explicit. */ + /* Issue a warning if this is an ISO C 9x program or if -Wreturn-type + and this is a function, or if -Wimplicit; prefer the former + warning since it is more explicit. */ if ((warn_implicit_int || warn_return_type) && funcdef_flag) warn_about_return_type = 1; - else if (warn_implicit_int) + else if (warn_implicit_int || flag_isoc9x) warning ("type defaults to `int' in declaration of `%s'", name); } |