From 02cea057769b88c868a82333cfe2d5dcc1d35c3a Mon Sep 17 00:00:00 2001 From: pfg Date: Mon, 13 Jan 2014 15:32:37 +0000 Subject: [PATCH] MFC r259920: gcc: Implement -Wmost for compatibility with clang. This is equivalent to -Wall -Wno-parentheses. Obtained from: Apple GCC 4.2 - 5531 git-svn-id: svn://svn.freebsd.org/base/stable/8@260592 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- contrib/gcc/c-opts.c | 7 ++++++- contrib/gcc/c.opt | 6 ++++++ contrib/gcc/doc/invoke.texi | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/contrib/gcc/c-opts.c b/contrib/gcc/c-opts.c index 7f193749f..c07050c38 100644 --- a/contrib/gcc/c-opts.c +++ b/contrib/gcc/c-opts.c @@ -385,12 +385,17 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT_Wall: + /* APPLE LOCAL -Wmost */ + case OPT_Wmost: set_Wunused (value); set_Wformat (value); set_Wimplicit (value); warn_char_subscripts = value; warn_missing_braces = value; - warn_parentheses = value; + /* APPLE LOCAL begin -Wmost --dpatel */ + if (code != OPT_Wmost) + warn_parentheses = value; + /* APPLE LOCAL end -Wmost --dpatel */ warn_return_type = value; warn_sequence_point = value; /* Was C only. */ if (c_dialect_cxx ()) diff --git a/contrib/gcc/c.opt b/contrib/gcc/c.opt index 820e5c986..0f5f194fb 100644 --- a/contrib/gcc/c.opt +++ b/contrib/gcc/c.opt @@ -284,6 +284,12 @@ Wmissing-prototypes C ObjC Var(warn_missing_prototypes) Warn about global functions without prototypes +; APPLE LOCAL begin -Wmost +Wmost +C ObjC C++ ObjC++ +Like -Wall but without -Wparentheses +; APPLE LOCAL end -Wmost + Wmultichar C ObjC C++ ObjC++ Warn about use of multi-character character constants diff --git a/contrib/gcc/doc/invoke.texi b/contrib/gcc/doc/invoke.texi index 23d4f63dc..8a8b065e5 100644 --- a/contrib/gcc/doc/invoke.texi +++ b/contrib/gcc/doc/invoke.texi @@ -238,6 +238,8 @@ Objective-C and Objective-C++ Dialects}. -Wmain -Wmissing-braces -Wmissing-field-initializers @gol -Wmissing-format-attribute -Wmissing-include-dirs @gol -Wmissing-noreturn @gol +@c APPLE LOCAL -Wmost +-Wmost (APPLE ONLY) @gol -Wno-multichar -Wnonnull -Wno-overflow @gol -Woverlength-strings -Wpacked -Wpadded @gol -Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol @@ -2897,7 +2899,12 @@ that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. This also enables some language-specific warnings described in @ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect Options}. +@c APPLE LOCAL begin -Wmost +@item -Wmost +@opindex Wmost +This is equivalent to -Wall -Wno-parentheses. (Apple compatible) @end table +@c APPLE LOCAL end -Wmost The following @option{-W@dots{}} options are not implied by @option{-Wall}. Some of them warn about constructions that users generally do not -- 2.45.0