Revert "introduced a GCC-like -Werror=type"

This reverts commit 981c53e257.
This commit is contained in:
Akim Demaille
2012-09-21 09:15:45 +02:00
parent 6652eeba58
commit 0d43e6057b
4 changed files with 31 additions and 77 deletions

View File

@@ -31,7 +31,6 @@
warnings warnings_flag = warnings warnings_flag =
Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother; Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother;
warnings errors_flag;
bool complaint_issued; bool complaint_issued;
static unsigned *indent_ptr = 0; static unsigned *indent_ptr = 0;
@@ -56,9 +55,7 @@ warnings_print_categories (warnings warn_flags)
for (i = 0; i < ARRAY_CARDINALITY (warn_names); ++i) for (i = 0; i < ARRAY_CARDINALITY (warn_names); ++i)
if (warn_flags & 1 << i) if (warn_flags & 1 << i)
{ {
bool err = warn_flags & errors_flag; fprintf (stderr, "%s-W%s", any ? ", " : " [", warn_names[i]);
fprintf (stderr, "%s-W", any ? ", " : " [");
fprintf (stderr, "%s%s", err ? "error=" : "" , warn_names[i]);
any = true; any = true;
} }
if (any) if (any)
@@ -142,16 +139,14 @@ complains (const location *loc, warnings flags, const char *message,
} }
else if (warnings_flag & Wyacc) else if (warnings_flag & Wyacc)
{ {
char* severity = Wyacc & errors_flag ? _("error") : _("warning"); set_warning_issued ();
set_warning_issued (Wyacc); error_message (loc, flags, _("warning"), message, args);
error_message (loc, flags, severity, message, args);
} }
} }
else if (warnings_flag & flags) else if (warnings_flag & flags)
{ {
char* severity = flags & errors_flag ? _("error") : _("warning"); set_warning_issued ();
set_warning_issued (flags); error_message (loc, flags, _("warning"), message, args);
error_message (loc, flags, severity, message, args);
} }
} }
@@ -189,10 +184,10 @@ void complain_at_indent (location loc, warnings flags, unsigned *indent,
`--------------------------------*/ `--------------------------------*/
void void
set_warning_issued (warnings warning) set_warning_issued (void)
{ {
static bool warning_issued = false; static bool warning_issued = false;
if (!warning_issued && (warning & warnings_flag & errors_flag)) if (!warning_issued && (warnings_flag & Werror))
{ {
fprintf (stderr, "%s: warnings being treated as errors\n", program_name); fprintf (stderr, "%s: warnings being treated as errors\n", program_name);
complaint_issued = true; complaint_issued = true;

View File

@@ -35,23 +35,16 @@ typedef enum
Wdeprecated = 1 << 4, /**< Obsolete constructs. */ Wdeprecated = 1 << 4, /**< Obsolete constructs. */
Wother = 1 << 5, /**< All other warnings. */ Wother = 1 << 5, /**< All other warnings. */
/* Deprecated, this option now uses a second instance of this enum */
Werror = 1 << 10, /**< Warnings are treated as errors. */ Werror = 1 << 10, /**< Warnings are treated as errors. */
complaint = 1 << 11, /**< All complaints. */ complaint = 1 << 11, /**< All complaints. */
fatal = 1 << 12, /**< All fatal errors. */ fatal = 1 << 12, /**< All fatal errors. */
silent = 1 << 13, /**< Do not display the warning type. */ silent = 1 << 13, /**< Do not display the warning type. */
Wall = ~Werror /**< All above warnings. */
/**< All above warnings. */
Wall = ~complaint & ~fatal & ~silent
} warnings; } warnings;
/** What warnings are issued. */ /** What warnings are issued. */
extern warnings warnings_flag; extern warnings warnings_flag;
/** What warnings are made errors. */
extern warnings errors_flag;
/** Display a "[-Wyacc]" like message on stderr. */ /** Display a "[-Wyacc]" like message on stderr. */
void warnings_print_categories (warnings warn_flags); void warnings_print_categories (warnings warn_flags);
@@ -60,7 +53,7 @@ void warnings_print_categories (warnings warn_flags);
only for the sake of Yacc-compatible conflict reports in conflicts.c. only for the sake of Yacc-compatible conflict reports in conflicts.c.
All other warnings should be implemented in complain.c and should use All other warnings should be implemented in complain.c and should use
the normal warning format. */ the normal warning format. */
void set_warning_issued (warnings warning); void set_warning_issued (void);
/** Make a complaint, but don't specify any location. */ /** Make a complaint, but don't specify any location. */
void complain (warnings flags, char const *message, ...) void complain (warnings flags, char const *message, ...)

View File

@@ -602,10 +602,8 @@ conflicts_print (void)
} }
if (src_total | rrc_total) if (src_total | rrc_total)
{ {
if (expected_sr_conflicts == -1 && src_total) if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
set_warning_issued (Wconflicts_sr); set_warning_issued ();
if (expected_rr_conflicts == -1 && rrc_total)
set_warning_issued (Wconflicts_rr);
if (! yacc_flag) if (! yacc_flag)
fprintf (stderr, "%s: ", current_file); fprintf (stderr, "%s: ", current_file);
conflict_report (stderr, src_total, rrc_total); conflict_report (stderr, src_total, rrc_total);

View File

@@ -83,63 +83,31 @@ flags_argmatch (const char *option,
int all, int *flags, char *args) int all, int *flags, char *args)
{ {
if (args) if (args)
{
args = strtok (args, ",");
/* Not sure whether we should keep this : -Werror=no-bar */
int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
args += no;
int value = 0;
while (args)
{ {
int err = STRPREFIX_LIT ("error", args); args = strtok (args, ",");
if (err) while (args)
args += (args[5] == '=') ? 6 : 5;
if (!err || args[-1] == '=')
value = XARGMATCH (option, args, keys, values);
if (value == 0)
{
if (no)
{ {
if (err) int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
/* Using &= ~all activates complaint, silent and fatal */ int value = XARGMATCH (option, args + no, keys, values);
errors_flag = Wnone; if (value == 0)
{
if (no)
*flags |= all;
else
*flags &= ~all;
}
else else
*flags |= all; {
if (no)
*flags &= ~value;
else
*flags |= value;
}
args = strtok (NULL, ",");
} }
else
{
if (err)
errors_flag |= all;
else
*flags &= ~all;
}
}
else
{
if (no)
{
if (err)
errors_flag &= ~value;
else
*flags &= ~value;
}
else
{
if (err)
{
errors_flag |= value;
warnings_flag |= value;
}
else
*flags |= value;
}
}
args = strtok (NULL, ",");
} }
} else
*flags |= all;
} }
/** Decode a set of sub arguments. /** Decode a set of sub arguments.