diff options
author | Zack Weinberg <zack@codesourcery.com> | 2002-02-27 18:48:07 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2002-02-27 18:48:07 +0000 |
commit | f458d1d5d7bd85e412689858ea5d5de681608fbb (patch) | |
tree | aff434354f9eafe5065d231d996385e95f0669b4 /gcc/c-lex.c | |
parent | e0b3a8ff40c97c0b633185e6d0872468504a7a1a (diff) | |
download | gcc-f458d1d5d7bd85e412689858ea5d5de681608fbb.zip gcc-f458d1d5d7bd85e412689858ea5d5de681608fbb.tar.gz gcc-f458d1d5d7bd85e412689858ea5d5de681608fbb.tar.bz2 |
c-common.c, [...]: Delete code implementing -traditional mode.
* c-common.c, c-common.h, c-decl.c, c-lex.c, c-parse.in,
c-tree.h, c-typeck.c, cppexp.c, cpplex.c, cpplib.c, cpplib.h,
cppmacro.c, objc/lang-specs.h, objc/objc-act.c,
builtin-types.def, builtins.def, dwarf2out.c, dwarfout.c,
gcc.c, toplev.c: Delete code implementing -traditional mode.
* ada/misc.c, ch/ch-tree.h, ch/decl.c, cp/decl2.c, f/com.c,
f/lex.c, f/top.c, java/builtins.c, java/decl.c: Delete
traditional-mode-related code copied from the C front end
but not used, or used only to permit the compiler to link.
* doc/bugreport.texi, doc/cpp.texi, doc/extend.texi,
doc/invoke.texi, doc/standards.texi, doc/trouble.texi:
Document removal of -traditional mode for compilation, and
remove documentation only relevant to that mode.
* config/nextstep.h, config/ptx4.h, config/svr4.h,
config/convex/convex.h, config/d30v/d30v.h,
config/i386/dgux.h, config/i386/osf1elf.h,
config/i386/osfelf.h, config/i386/osfrose.h,
config/i386/sco5.h, config/i386/sol2.h, config/m68k/a-ux.h,
config/m68k/hp310.h, config/m88k/dgux.h,
config/m88k/dguxbcs.h, config/m88k/luna.h, config/m88k/m88k.c,
config/m88k/m88k.h, config/m88k/openbsd.h,
config/mips/abi64.h, config/mips/osfrose.h,
config/mips/svr4-5.h, config/mips/svr4-t.h,
config/sparc/sol2-sld-64.h, config/sparc/sol2.h,
config/stormy16/stormy16.h: Remove all references to
-traditional from target specs. Delete all mention of the
no-longer-necessary TRADITIONAL_RETURN_FLOAT macro. Also
delete a couple of commented-out definitions of
DOLLARS_IN_IDENTIFIERS, with (incorrect) commentary referring
to -traditional.
* system.h: Poison TRADITIONAL_RETURN_FLOAT.
* doc/tm.texi: Remove mention of TRADITIONAL_RETURN_FLOAT macro.
* testsuite/gcc.c-torture/execute/920730-1t.c,
testsuite/gcc.c-torture/execute/920730-1t.x,
testsuite/gcc.dg/ext-glob.c: Delete test cases, only relevant
to -traditional.
From-SVN: r50110
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 92 |
1 files changed, 38 insertions, 54 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index a0d2bbd..8c5c3e7 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1065,7 +1065,7 @@ lex_number (str, len) #ifdef ERANGE /* ERANGE is also reported for underflow, so test the value to distinguish overflow from that. */ - if (conversion_errno == ERANGE && !flag_traditional && pedantic + if (conversion_errno == ERANGE && pedantic && (REAL_VALUES_LESS (dconst1, real) || REAL_VALUES_LESS (real, dconstm1))) warning ("floating point number exceeds range of 'double'"); @@ -1080,7 +1080,7 @@ lex_number (str, len) } else { - tree trad_type, ansi_type, type; + tree trad_type, type; HOST_WIDE_INT high, low; int spec_unsigned = 0; int spec_long = 0; @@ -1089,7 +1089,7 @@ lex_number (str, len) int suffix_lu = 0; int warn = 0, i; - trad_type = ansi_type = type = NULL_TREE; + trad_type = type = NULL_TREE; while (p < str + len) { c = *p++; @@ -1161,11 +1161,9 @@ lex_number (str, len) TREE_TYPE (value) = long_long_unsigned_type_node; /* If warn_traditional, calculate both the ISO type and the - traditional type, then see if they disagree. - Otherwise, calculate only the type for the dialect in use. */ - if (warn_traditional || flag_traditional) + traditional type, then see if they disagree. */ + if (warn_traditional) { - /* Calculate the traditional type. */ /* Traditionally, any constant is signed; but if unsigned is specified explicitly, obey that. Use the smallest size with the right number of bits, except for one special @@ -1195,50 +1193,46 @@ lex_number (str, len) ? widest_unsigned_literal_type_node : widest_integer_literal_type_node); } - if (warn_traditional || ! flag_traditional) - { - /* Calculate the ISO type. */ - if (! spec_long && ! spec_unsigned - && int_fits_type_p (value, integer_type_node)) - ansi_type = integer_type_node; - else if (! spec_long && (base != 10 || spec_unsigned) - && int_fits_type_p (value, unsigned_type_node)) - ansi_type = unsigned_type_node; - else if (! spec_unsigned && !spec_long_long - && int_fits_type_p (value, long_integer_type_node)) - ansi_type = long_integer_type_node; - else if (! spec_long_long - && int_fits_type_p (value, long_unsigned_type_node)) - ansi_type = long_unsigned_type_node; - else if (! spec_unsigned - && int_fits_type_p (value, long_long_integer_type_node)) - ansi_type = long_long_integer_type_node; - else if (int_fits_type_p (value, long_long_unsigned_type_node)) - ansi_type = long_long_unsigned_type_node; - else if (! spec_unsigned - && int_fits_type_p (value, widest_integer_literal_type_node)) - ansi_type = widest_integer_literal_type_node; - else - ansi_type = widest_unsigned_literal_type_node; - } - - type = flag_traditional ? trad_type : ansi_type; + + /* Calculate the ISO type. */ + if (! spec_long && ! spec_unsigned + && int_fits_type_p (value, integer_type_node)) + type = integer_type_node; + else if (! spec_long && (base != 10 || spec_unsigned) + && int_fits_type_p (value, unsigned_type_node)) + type = unsigned_type_node; + else if (! spec_unsigned && !spec_long_long + && int_fits_type_p (value, long_integer_type_node)) + type = long_integer_type_node; + else if (! spec_long_long + && int_fits_type_p (value, long_unsigned_type_node)) + type = long_unsigned_type_node; + else if (! spec_unsigned + && int_fits_type_p (value, long_long_integer_type_node)) + type = long_long_integer_type_node; + else if (int_fits_type_p (value, long_long_unsigned_type_node)) + type = long_long_unsigned_type_node; + else if (! spec_unsigned + && int_fits_type_p (value, widest_integer_literal_type_node)) + type = widest_integer_literal_type_node; + else + type = widest_unsigned_literal_type_node; /* We assume that constants specified in a non-decimal base are bit patterns, and that the programmer really meant what they wrote. */ if (warn_traditional && !in_system_header - && base == 10 && trad_type != ansi_type) + && base == 10 && trad_type != type) { - if (TYPE_PRECISION (trad_type) != TYPE_PRECISION (ansi_type)) - warning ("width of integer constant changes with -traditional"); - else if (TREE_UNSIGNED (trad_type) != TREE_UNSIGNED (ansi_type)) - warning ("integer constant is unsigned in ISO C, signed with -traditional"); + if (TYPE_PRECISION (trad_type) != TYPE_PRECISION (type)) + warning ("width of integer constant is different in traditional C"); + else if (TREE_UNSIGNED (trad_type) != TREE_UNSIGNED (type)) + warning ("integer constant is unsigned in ISO C, signed in traditional C"); else - warning ("width of integer constant may change on other systems with -traditional"); + warning ("width of integer constant may change on other systems in traditional C"); } - if (pedantic && !flag_traditional && (flag_isoc99 || !spec_long_long) + if (pedantic && (flag_isoc99 || !spec_long_long) && !warn && ((flag_isoc99 ? TYPE_PRECISION (long_long_integer_type_node) @@ -1265,15 +1259,6 @@ lex_number (str, len) else ERROR ("complex integer constant is too wide for 'complex int'"); } - else if (flag_traditional && !int_fits_type_p (value, type)) - /* The traditional constant 0x80000000 is signed - but doesn't fit in the range of int. - This will change it to -0x80000000, which does fit. */ - { - TREE_TYPE (value) = unsigned_type (type); - value = convert (type, value); - TREE_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (value) = 0; - } else TREE_TYPE (value) = type; @@ -1345,8 +1330,7 @@ lex_string (str, len, wide) else mask = ~0; c = cpp_parse_escape (parse_in, (const unsigned char **) &p, - (const unsigned char *) limit, - mask, flag_traditional); + (const unsigned char *) limit, mask); } /* Add this single character into the buffer either as a wchar_t @@ -1409,7 +1393,7 @@ lex_charconst (token) unsigned int chars_seen; result = cpp_interpret_charconst (parse_in, token, warn_multichar, - flag_traditional, &chars_seen); + &chars_seen); if (token->type == CPP_WCHAR) { value = build_int_2 (result, 0); |