+2015-08-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * doc/options.texi (EnabledBy): Document that the argument must be
+ a Common option.
+ * doc/invoke.texi (Wnull-dereference): Move after Wnonnull.
+ Not enabled by -Wall.
+ * optc-gen.awk: Give nicer error messages. Detect if the argument
+ of EnabledBy is not a Common option.
+ * common.opt (Wnull-dereference): Not enabled by -Wall.
+ * opt-functions.awk (lang_enabled_by): Nicer error messages.
+
2015-08-09 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/driver-i386.c (host_detect_local_cpu): Treat
+2015-08-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * c.opt (Wchkp): Use LangEnabledBy instead of EnabledBy.
+
2015-08-06 Andrew Sutton <andrew.n.sutton@gmail.com>
Braden Obrzut <admin@maniacsvault.net>
Jason Merrill <jason@redhat.com>
Warn about subscripts whose type is \"char\"
Wchkp
-C ObjC C++ ObjC++ Var(warn_chkp) Warning EnabledBy(Wall)
+C ObjC C++ ObjC++ Var(warn_chkp) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about memory access errors found by Pointer Bounds Checker
Wclobbered
-Wlarger-than=<number> Warn if an object is larger than <number> bytes
Wnull-dereference
-Common Var(warn_null_dereference) Warning EnabledBy(Wall)
+Common Var(warn_null_dereference) Warning
Warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior
Wunsafe-loop-optimizations
@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
can be disabled with the @option{-Wno-nonnull} option.
+@item -Wnull-dereference
+@opindex Wnull-dereference
+@opindex Wno-null-dereference
+Warn if the compiler detects paths that trigger erroneous or
+undefined behavior due to dereferencing a null pointer. This option
+is only active when @option{-fdelete-null-pointer-checks} is active,
+which is enabled by optimizations in most targets. The precision of
+the warnings depends on the optimization options used.
+
@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
@opindex Winit-self
@opindex Wno-init-self
either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
@option{-Wunused}), or separately specify @option{-Wunused-parameter}.
-@item -Wnull-dereference
-@opindex Wnull-dereference
-@opindex Wno-null-dereference
-Warn if the compiler detects paths that trigger erroneous or
-undefined behavior due to dereferencing a null pointer. This option
-is only active when @option{-fdelete-null-pointer-checks} is active,
-which is enabled by optimizations in most targets. The precision of
-the warnings depends on the optimization options used. This option is
-enabled by @option{-Wall}.
-
@item -Wuninitialized
@opindex Wuninitialized
@opindex Wno-uninitialized
If not explicitly set, the option is set to the value of
@option{-@var{opt}}; multiple options can be given, separated by
@code{||}. The third form using @code{&&} specifies that the option is
-only set if both @var{opt} and @var{opt2} are set.
+only set if both @var{opt} and @var{opt2} are set. The options @var{opt}
+and @var{opt2} must have the @code{Common} property; otherwise, use
+@code{LangEnabledBy}.
@item LangEnabledBy(@var{language}, @var{opt})
@itemx LangEnabledBy(@var{language}, @var{opt}, @var{posarg}, @var{negarg})
} else if (enabledby_posarg == "" && enabledby_negarg == "") {
with_args = ""
} else {
- print "#error LangEnabledBy("enabledby_langs","enabledby_name", " \
+ print "#error " opts[i] " LangEnabledBy("enabledby_langs","enabledby_name", " \
enabledby_posarg", " enabledby_negargs \
") with three arguments, it should have either 2 or 4"
}
for (k = 1; k <= n_enabledby_array; k++) {
enabledby_index = opt_numbers[enabledby_array[k]];
if (enabledby_index == "") {
- print "#error LangEnabledBy("enabledby_langs","enabledby_name", " \
- enabledby_posarg", " enabledby_negargs") has invalid ENABLEDBY_NAME"
+ print "#error " opts[i] " LangEnabledBy("enabledby_langs","enabledby_name", " \
+ enabledby_posarg", " enabledby_negargs"), unknown option '" enabledby_name "'"
} else {
for (j = 1; j <= n_enabledby_arg_langs; j++) {
lang_name = lang_sanitized_name(enabledby_arg_langs[j]);
# Dump that array of options into a C file.
END {
-# Record first EnabledBy and LangEnabledBy uses.
+
+# Combine the flags of identical switches. Switches
+# appear many times if they are handled by many front
+# ends, for example.
+for (i = 0; i < n_opts; i++) {
+ merged_flags[i] = flags[i]
+}
+for (i = 0; i < n_opts; i++) {
+ while(i + 1 != n_opts && opts[i] == opts[i + 1] ) {
+ merged_flags[i + 1] = merged_flags[i] " " merged_flags[i + 1];
+ i++;
+ }
+}
+
+# Record EnabledBy and LangEnabledBy uses.
n_enabledby = 0;
for (i = 0; i < n_langs; i++) {
n_enabledby_lang[i] = 0;
}
n_enabledby_names = split(enabledby_arg, enabledby_names, split_sep);
if (logical_and != 0 && n_enabledby_names > 2) {
- print "#error EnabledBy (Wfoo && Wbar && Wbaz) not currently supported"
+ print "#error " opts[i] " EnabledBy(Wfoo && Wbar && Wbaz) currently not supported"
}
for (j = 1; j <= n_enabledby_names; j++) {
enabledby_name = enabledby_names[j];
enabledby_index = opt_numbers[enabledby_name];
if (enabledby_index == "") {
- print "#error Enabledby: " enabledby_name
- } else {
- condition = "";
+ print "#error " opts[i] " Enabledby(" enabledby_name "), unknown option '" enabledby_name "'"
+ } else if (!flag_set_p("Common", merged_flags[enabledby_index])) {
+ print "#error " opts[i] " Enabledby(" enabledby_name "), '" \
+ enabledby_name "' must have flag 'Common'" \
+ " to use Enabledby(), otherwise use LangEnabledBy()"
+ } else {
+ condition = "";
if (logical_and != 0) {
opt_var_name_1 = search_var_name(enabledby_names[1], opt_numbers, opts, flags, n_opts);
opt_var_name_2 = search_var_name(enabledby_names[2], opt_numbers, opts, flags, n_opts);