aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2002-08-02 04:18:16 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-08-02 04:18:16 +0000
commit56da7207c1b5d008ead2df641f3008c25568f3ca (patch)
treec63ec9dce2bc93a6a52925534a75b6d065be7679 /gcc/cppexp.c
parent88c3865996f3be69203664a3889ec54bbeeb8c04 (diff)
downloadgcc-56da7207c1b5d008ead2df641f3008c25568f3ca.zip
gcc-56da7207c1b5d008ead2df641f3008c25568f3ca.tar.gz
gcc-56da7207c1b5d008ead2df641f3008c25568f3ca.tar.bz2
c-common.c (c_common_init): -Wtraditional also implies -Wlong-long.
* c-common.c (c_common_init): -Wtraditional also implies -Wlong-long. * cppinit.c (cpp_post_options): Likewise. * cppexp.c (cpp_classify_number): Suppress -Wtraditional warning about 'LL' suffix (but not 'ULL' etc) when -Wno-long-long is in effect. * cppmacro.c (_cpp_builtin_macro_text) [BT_TIME, BT_DATE]: Check for failing time()/localtime(), issue a warning, and make __TIME__ and __DATE__ expand to fallback strings. * doc/cpp.texi, doc/extend.texi: Document behavior of __DATE__ and __TIME__ when the date and time cannot be determined. From-SVN: r55969
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 5690436..a3ef965 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -270,13 +270,18 @@ cpp_classify_number (pfile, token)
return CPP_N_INVALID;
}
- /* Traditional C only accepted the 'L' suffix. */
- if (result != CPP_N_SMALL && result != CPP_N_MEDIUM
- && CPP_WTRADITIONAL (pfile)
- && ! cpp_sys_macro_p (pfile))
- cpp_error (pfile, DL_WARNING,
- "traditional C rejects the \"%.*s\" suffix",
- (int) (limit - str), str);
+ /* Traditional C only accepted the 'L' suffix.
+ Suppress warning about 'LL' with -Wno-long-long. */
+ if (CPP_WTRADITIONAL (pfile) && ! cpp_sys_macro_p (pfile))
+ {
+ int u_or_i = (result & (CPP_N_UNSIGNED|CPP_N_IMAGINARY));
+ int large = (result & CPP_N_WIDTH) == CPP_N_LARGE;
+
+ if (u_or_i || (large && CPP_OPTION (pfile, warn_long_long)))
+ cpp_error (pfile, DL_WARNING,
+ "traditional C rejects the \"%.*s\" suffix",
+ (int) (limit - str), str);
+ }
if ((result & CPP_N_WIDTH) == CPP_N_LARGE
&& ! CPP_OPTION (pfile, c99)