diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ecce7d2d30e..9fdfd60490b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +1998-07-08 Vladimir N. Makarov + + * toplev.c (lang_options): Add -Wlong-long, -Wno-long-long + options. + * c-decl.c (warn_long_long): Define. + (c_decode_option): Parse -Wlong-long, -Wno-long-long options. + (grokdeclarator): Add flag `warn_long_long' as guard for + warning "ANSI C does not support `long long'". + * invoke.texi: Add description of options -Wlong-long, + -Wno-long-long. + * gcc.1: The same as above. + Wed Jul 8 02:43:34 1998 Jeffrey A Law (law@cygnus.com) * rtlanal.c (reg_overlap_mentioned_p): Handle STRICT_LOW_PART. If diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9901db80e68..3af985d732d 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -485,6 +485,10 @@ int flag_no_ident = 0; int warn_implicit_int; +/* Nonzero means warn about usage of long long when `-pedantic'. */ + +int warn_long_long = 1; + /* Nonzero means message about use of implicit function declarations; 1 means warning; 2 means error. */ @@ -704,6 +708,10 @@ c_decode_option (argc, argv) } else if (!strcmp (p, "-Wno-implicit")) warn_implicit_int = 0, mesg_implicit_function_declaration = 0; + else if (!strcmp (p, "-Wlong-long")) + warn_long_long = 1; + else if (!strcmp (p, "-Wno-long-long")) + warn_long_long = 0; else if (!strcmp (p, "-Wwrite-strings")) warn_write_strings = 1; else if (!strcmp (p, "-Wno-write-strings")) @@ -4406,7 +4414,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) error ("`long long long' is too long for GCC"); else { - if (pedantic && ! in_system_header) + if (pedantic && ! in_system_header && warn_long_long) pedwarn ("ANSI C does not support `long long'"); longlong = 1; } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6ad5d3f345c..3849f64c596 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +1998-07-08 Vladimir N. Makarov + + * cp-tree.h (warn_long_long): Define. + * decl.c (grokdeclarator): Add flag `warn_long_long' as guard for + warning "ANSI C++ does not support `long long'". + * decl2.c (warn_long_long): Define. + (lang_decode_option): Parse -Wlong-long, -Wno-long-long options. + 1998-07-07 Jason Merrill * decl.c (xref_tag): Handle attributes between 'class' and name. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8d05b783948..71ae91128e5 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -329,6 +329,10 @@ extern int flag_no_ident; extern int warn_implicit; +/* Nonzero means warn about usage of long long when `-pedantic'. */ + +extern int warn_long_long; + /* Nonzero means warn when all ctors or dtors are private, and the class has no friends. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f6b0cfeb077..d8522e0e949 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8436,7 +8436,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) { if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits)) { - if (pedantic && ! in_system_header) + if (pedantic && ! in_system_header && warn_long_long) pedwarn ("ANSI C++ does not support `long long'"); if (longlong) error ("`long long long' is too long for GCC"); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index fd6167cb2af..8f844076a01 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -178,6 +178,10 @@ int flag_implicit_templates = 1; int warn_implicit = 1; +/* Nonzero means warn about usage of long long when `-pedantic'. */ + +int warn_long_long = 1; + /* Nonzero means warn when all ctors or dtors are private, and the class has no friends. */ @@ -686,6 +690,8 @@ lang_decode_option (argc, argv) if (!strcmp (p, "implicit")) warn_implicit = setting; + else if (!strcmp (p, "long-long")) + warn_long_long = setting; else if (!strcmp (p, "return-type")) warn_return_type = setting; else if (!strcmp (p, "ctor-dtor-privacy")) diff --git a/gcc/gcc.1 b/gcc/gcc.1 index 8661aa2b624..b4ff586e906 100644 --- a/gcc/gcc.1 +++ b/gcc/gcc.1 @@ -193,6 +193,7 @@ in the following sections. \-Wimplicit\-int \-Wimplicit\-function\-declaration \-Winline +\-Wlong\-long \-Wmain \-Wmissing\-prototypes \-Wmissing\-declarations @@ -2004,6 +2005,20 @@ Warn if an \c .B \-Wenum\-clash Warn about conversion between different enumeration types (C++ only). .TP +.B \-Wlong-long +Warn if +.B long long \c +type is used. This is default. To inhibit +the warning messages, use flag `\|\c +.B \-Wno\-long\-long\c +\&\|'. Flags `\|\c +.B \-W\-long\-long\c +\&\|' and `\|\c +.B \-Wno\-long\-long\c +\&\|' are taken into account only when flag `\|\c +.B \-pedantic\c +\&\|' is used. +.TP .B \-Woverloaded\-virtual (C++ only.) In a derived class, the definitions of virtual functions must match diff --git a/gcc/invoke.texi b/gcc/invoke.texi index 5bfac524c5c..5cd5432bcad 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -121,7 +121,8 @@ in the following sections. -Wid-clash-@var{len} -Wimplicit -Wimplicit-int -Wimplicit-function-declaration -Wimport -Werror-implicit-function-declaration -Winline --Wlarger-than-@var{len} -Wmain -Wmissing-declarations +-Wlarger-than-@var{len} -Wlong-long +-Wmain -Wmissing-declarations -Wmissing-prototypes -Wmultichar -Wnested-externs -Wno-import -Wold-style-cast -Woverloaded-virtual -Wparentheses -Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type @@ -1704,6 +1705,12 @@ main () In this example, g++ will synthesize a default @samp{A& operator = (const A&);}, while cfront will use the user-defined @samp{operator =}. +@item -Wlong-long +Warn if @samp{long long} type is used. This is default. To inhibit +the warning messages, use @samp{-Wno-long-long}. Flags +@samp{-Wlong-long} and @samp{-Wno-long-long} are taken into account +only when @samp{-pedantic} flag is used. + @item -Werror Make all warnings into errors. @end table diff --git a/gcc/toplev.c b/gcc/toplev.c index 1126a4af2fc..d63b0c25c80 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -864,6 +864,8 @@ char *lang_options[] = "-Wno-implicit-int", "-Wimplicit", "-Wno-implicit", + "-Wlong-long", + "-Wno-long-long", "-Wmain", "-Wno-main", "-Wmissing-braces",