order. */
vblist = tree_cons (NULL_TREE, argvbs, vblist);
- unsigned nelts = 0;
- for (tree vb = argvbs; vb; vb = TREE_CHAIN (vb), ++nelts)
+ for (tree vb = argvbs; vb; vb = TREE_CHAIN (vb))
{
tree bound = TREE_VALUE (vb);
if (const unsigned *psizpos = arg2pos.get (bound))
SET_OPTION_IF_UNSET (&global_options, &global_options_set,
flag_range_for_ext_temps, cxx_dialect >= cxx23);
+ /* EnabledBy unfortunately can't specify value to use if set and
+ LangEnabledBy can't specify multiple options with &&. For -Wunused
+ or -Wunused -Wextra we want these to default to 3 unless user specified
+ some other level explicitly. */
+ if (warn_unused_but_set_parameter == 1)
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_unused_but_set_parameter, 3);
+ if (warn_unused_but_set_variable == 1)
+ SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+ warn_unused_but_set_variable, 3);
+
/* -fimmediate-escalation has no effect when immediate functions are not
supported. */
if (flag_immediate_escalation && cxx_dialect < cxx20)
case VAR_DECL:
/* Warnings for unused variables. */
if ((!TREE_USED (p) || !DECL_READ_P (p))
- && !warning_suppressed_p (p, OPT_Wunused_but_set_variable)
+ && !warning_suppressed_p (p, OPT_Wunused_but_set_variable_)
&& !DECL_IN_SYSTEM_HEADER (p)
&& DECL_NAME (p)
&& !DECL_ARTIFICIAL (p)
}
else if (DECL_CONTEXT (p) == current_function_decl)
warning_at (DECL_SOURCE_LOCATION (p),
- OPT_Wunused_but_set_variable,
+ OPT_Wunused_but_set_variable_,
"variable %qD set but not used", p);
}
&& !DECL_READ_P (decl)
&& DECL_NAME (decl)
&& !DECL_ARTIFICIAL (decl)
- && !warning_suppressed_p (decl, OPT_Wunused_but_set_parameter))
+ && !warning_suppressed_p (decl, OPT_Wunused_but_set_parameter_))
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_parameter,
+ OPT_Wunused_but_set_parameter_,
"parameter %qD set but not used", decl);
}
c_parser_consume_token (parser);
exp_loc = c_parser_peek_token (parser)->location;
op = c_parser_cast_expression (parser, NULL);
-
- op = default_function_array_read_conversion (exp_loc, op);
+ if ((VAR_P (op.value) || TREE_CODE (op.value) == PARM_DECL)
+ && !DECL_READ_P (op.value)
+ && (VAR_P (op.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ {
+ op = default_function_array_read_conversion (exp_loc, op);
+ DECL_READ_P (op.value) = 0;
+ }
+ else
+ op = default_function_array_read_conversion (exp_loc, op);
return parser_build_unary_op (op_loc, PREINCREMENT_EXPR, op);
case CPP_MINUS_MINUS:
c_parser_consume_token (parser);
exp_loc = c_parser_peek_token (parser)->location;
op = c_parser_cast_expression (parser, NULL);
-
- op = default_function_array_read_conversion (exp_loc, op);
+ if ((VAR_P (op.value) || TREE_CODE (op.value) == PARM_DECL)
+ && !DECL_READ_P (op.value)
+ && (VAR_P (op.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ {
+ op = default_function_array_read_conversion (exp_loc, op);
+ DECL_READ_P (op.value) = 0;
+ }
+ else
+ op = default_function_array_read_conversion (exp_loc, op);
return parser_build_unary_op (op_loc, PREDECREMENT_EXPR, op);
case CPP_AND:
c_parser_consume_token (parser);
start = expr.get_start ();
finish = c_parser_peek_token (parser)->get_finish ();
c_parser_consume_token (parser);
- expr = default_function_array_read_conversion (expr_loc, expr);
+ if ((VAR_P (expr.value) || TREE_CODE (expr.value) == PARM_DECL)
+ && !DECL_READ_P (expr.value)
+ && (VAR_P (expr.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1
+ && TREE_CODE (TREE_TYPE (expr.value)) != ARRAY_TYPE)
+ {
+ expr = default_function_array_read_conversion (expr_loc, expr);
+ DECL_READ_P (expr.value) = 0;
+ }
+ else
+ expr = default_function_array_read_conversion (expr_loc, expr);
expr.value = build_unary_op (op_loc, POSTINCREMENT_EXPR,
expr.value, false);
set_c_expr_source_range (&expr, start, finish);
start = expr.get_start ();
finish = c_parser_peek_token (parser)->get_finish ();
c_parser_consume_token (parser);
- expr = default_function_array_read_conversion (expr_loc, expr);
+ if ((VAR_P (expr.value) || TREE_CODE (expr.value) == PARM_DECL)
+ && !DECL_READ_P (expr.value)
+ && (VAR_P (expr.value) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1
+ && TREE_CODE (TREE_TYPE (expr.value)) != ARRAY_TYPE)
+ {
+ expr = default_function_array_read_conversion (expr_loc, expr);
+ DECL_READ_P (expr.value) = 0;
+ }
+ else
+ expr = default_function_array_read_conversion (expr_loc, expr);
expr.value = build_unary_op (op_loc, POSTDECREMENT_EXPR,
expr.value, false);
set_c_expr_source_range (&expr, start, finish);
case PARM_DECL:
DECL_READ_P (exp) = 1;
break;
+ CASE_CONVERT:
+ if (VOID_TYPE_P (TREE_TYPE (exp)))
+ switch (TREE_CODE (TREE_OPERAND (exp, 0)))
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ return;
+ default:
+ break;
+ }
+ /* FALLTHRU */
case ARRAY_REF:
case COMPONENT_REF:
case MODIFY_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
- CASE_CONVERT:
case ADDR_EXPR:
case VIEW_CONVERT_EXPR:
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
newrhs = build1 (EXCESS_PRECISION_EXPR, TREE_TYPE (rhs),
newrhs);
}
+ bool clear_decl_read = false;
+ if ((VAR_P (lhs) || TREE_CODE (lhs) == PARM_DECL)
+ && !DECL_READ_P (lhs)
+ && (VAR_P (lhs) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 2)
+ {
+ mark_exp_read (newrhs);
+ if (!DECL_READ_P (lhs))
+ clear_decl_read = true;
+ }
+
newrhs = build_binary_op (location,
modifycode, lhs, newrhs, true);
+ if (clear_decl_read)
+ DECL_READ_P (lhs) = 0;
/* The original type of the right hand side is no longer
meaningful. */
int n_infiles = 0;
int n_outfiles = 0;
- // The number of input files when the language is "none" or "cobol"
- int n_cobol_files = 0;
-
// saw_OPT_no_main means "don't expect -main"
bool saw_OPT_no_main = false;
case OPT_SPECIAL_input_file:
no_files_error = false;
n_infiles += 1;
- if( strcmp(language, "none") == 0
- || strcmp(language, "cobol") == 0 )
- {
- n_cobol_files += 1;
- }
if( strstr(decoded_options[i].orig_option_with_args_text, "libgcobol.a") )
{
// We have been given an explicit libgcobol.a. We need to note that.
Enable all -Wunused- warnings.
Wunused-but-set-parameter
-Common Var(warn_unused_but_set_parameter) Warning EnabledBy(Wunused && Wextra)
+Common Alias(Wunused-but-set-parameter=,3,0) Warning
+
+Wunused-but-set-parameter=
+Common Var(warn_unused_but_set_parameter) RejectNegative Joined UInteger Warning IntegerRange(0, 3) EnabledBy(Wunused && Wextra)
Warn when a function parameter is only set, otherwise unused.
Wunused-but-set-variable
-Common Var(warn_unused_but_set_variable) Warning EnabledBy(Wunused)
+Common Alias(Wunused-but-set-variable=,3,0) Warning
+
+Wunused-but-set-variable=
+Common Var(warn_unused_but_set_variable) RejectNegative Joined UInteger Warning IntegerRange(0, 3) EnabledBy(Wunused)
Warn when a variable is only set, otherwise unused.
Wunused-function
Wunused-but-set-parameter
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-parameter)
+Wunused-but-set-parameter=
+UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-parameter)
+
Wunused-but-set-variable
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-variable)
+Wunused-but-set-variable=
+UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-but-set-variable)
+
Wunused-function
UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-function)
loc = EXPR_LOCATION (x);
op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), rval_ops, flags);
+ bool clear_decl_read;
+ clear_decl_read = false;
+ if (code == MODIFY_EXPR
+ && (VAR_P (op0) || TREE_CODE (op0) == PARM_DECL)
+ && !DECL_READ_P (op0))
+ clear_decl_read = true;
op1 = cp_fold_rvalue (TREE_OPERAND (x, 1), flags);
+ if (clear_decl_read)
+ DECL_READ_P (op0) = 0;
/* decltype(nullptr) has only one value, so optimize away all comparisons
with that type right away, keeping them in the IL causes troubles for
{
if (!DECL_NAME (decl) && DECL_DECOMPOSITION_P (decl))
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_variable, "structured "
+ OPT_Wunused_but_set_variable_, "structured "
"binding declaration set but not used");
else
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_variable,
+ OPT_Wunused_but_set_variable_,
"variable %qD set but not used", decl);
unused_but_set_errorcount = errorcount;
}
&& !DECL_READ_P (decl)
&& DECL_NAME (decl)
&& !DECL_ARTIFICIAL (decl)
- && !warning_suppressed_p (decl,OPT_Wunused_but_set_parameter)
+ && !warning_suppressed_p (decl, OPT_Wunused_but_set_parameter_)
&& !DECL_IN_SYSTEM_HEADER (decl)
&& TREE_TYPE (decl) != error_mark_node
&& !TYPE_REF_P (TREE_TYPE (decl))
&& (!CLASS_TYPE_P (TREE_TYPE (decl))
|| !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl))))
warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wunused_but_set_parameter,
+ OPT_Wunused_but_set_parameter_,
"parameter %qD set but not used", decl);
unused_but_set_errorcount = errorcount;
}
}
return expr;
}
- gcc_fallthrough();
+ gcc_fallthrough ();
CASE_CONVERT:
+ if (VOID_TYPE_P (TREE_TYPE (expr)))
+ switch (TREE_CODE (TREE_OPERAND (expr, 0)))
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ tree op0;
+ op0 = TREE_OPERAND (TREE_OPERAND (expr, 0), 0);
+ STRIP_ANY_LOCATION_WRAPPER (op0);
+ if ((VAR_P (op0) || TREE_CODE (op0) == PARM_DECL)
+ && !DECL_READ_P (op0)
+ && (VAR_P (op0) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ read_p = false;
+ break;
+ default:
+ break;
+ }
recurse_op[0] = true;
break;
case PARM_DECL:
DECL_READ_P (exp) = 1;
break;
+ CASE_CONVERT:
+ if (VOID_TYPE_P (TREE_TYPE (exp)))
+ switch (TREE_CODE (TREE_OPERAND (exp, 0)))
+ {
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
+ return;
+ default:
+ break;
+ }
+ /* FALLTHRU */
case ARRAY_REF:
case COMPONENT_REF:
case MODIFY_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
- CASE_CONVERT:
case ADDR_EXPR:
case INDIRECT_REF:
case FLOAT_EXPR:
case VIEW_CONVERT_EXPR:
+ case PREINCREMENT_EXPR:
+ case PREDECREMENT_EXPR:
+ case POSTINCREMENT_EXPR:
+ case POSTDECREMENT_EXPR:
mark_exp_read (TREE_OPERAND (exp, 0));
break;
case COMPOUND_EXPR:
{
tree existing_parm = existing ? DECL_ARGUMENTS (existing) : NULL_TREE;
tree parms = DECL_ARGUMENTS (fn);
- unsigned ix = 0;
- for (tree parm = parms; parm; parm = DECL_CHAIN (parm), ix++)
+ for (tree parm = parms; parm; parm = DECL_CHAIN (parm))
{
if (existing_parm)
{
if (!(complain & tf_warning))
return result;
+ /* These will never fold into a constant, so no need to check for
+ overflow for them. */
+ if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR)
+ return result;
+
tree result_ovl = result;
tree expr_ovl = expr;
if (val != 0)
goto return_build_unary_op;
- arg = mark_lvalue_use (arg);
+ tree stripped_arg;
+ stripped_arg = tree_strip_any_location_wrapper (arg);
+ if ((VAR_P (stripped_arg) || TREE_CODE (stripped_arg) == PARM_DECL)
+ && !DECL_READ_P (stripped_arg)
+ && (VAR_P (stripped_arg) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 1)
+ {
+ arg = mark_lvalue_use (arg);
+ DECL_READ_P (stripped_arg) = 0;
+ }
+ else
+ arg = mark_lvalue_use (arg);
/* Increment or decrement the real part of the value,
and don't change the imaginary part. */
{
auto_diagnostic_group d;
rhs = stabilize_expr (rhs, &init);
+ bool clear_decl_read = false;
+ tree stripped_lhs = tree_strip_any_location_wrapper (lhs);
+ if ((VAR_P (stripped_lhs) || TREE_CODE (stripped_lhs) == PARM_DECL)
+ && !DECL_READ_P (stripped_lhs)
+ && (VAR_P (stripped_lhs) ? warn_unused_but_set_variable
+ : warn_unused_but_set_parameter) > 2
+ && !CLASS_TYPE_P (TREE_TYPE (lhs))
+ && !CLASS_TYPE_P (TREE_TYPE (rhs)))
+ {
+ mark_exp_read (rhs);
+ if (!DECL_READ_P (stripped_lhs))
+ clear_decl_read = true;
+ }
newrhs = cp_build_binary_op (loc, modifycode, lhs, rhs, complain);
+ if (clear_decl_read)
+ DECL_READ_P (stripped_lhs) = 0;
if (newrhs == error_mark_node)
{
if (complain & tf_error)
case OPT_Wstrict_aliasing:
case OPT_Wunused:
case OPT_Wunused_function:
- case OPT_Wunused_but_set_variable:
+ case OPT_Wunused_but_set_variable_:
case OPT_Wunused_variable:
- case OPT_Wunused_but_set_parameter:
+ case OPT_Wunused_but_set_parameter_:
m_bits = NW_LEXICAL;
break;
-Wunsuffixed-float-constants
-Wunterminated-string-initialization
-Wunused
--Wunused-but-set-parameter -Wunused-but-set-variable
+-Wunused-but-set-parameter -Wunused-but-set-parameter=@var{n}
+-Wunused-but-set-variable -Wunused-but-set-variable=@var{n}
-Wunused-const-variable -Wunused-const-variable=@var{n}
-Wunused-function -Wunused-label -Wunused-local-typedefs
-Wunused-macros
@opindex Wunused-but-set-parameter
@opindex Wno-unused-but-set-parameter
@item -Wunused-but-set-parameter
+@option{-Wunused-but-set-parameter} is the same as
+@option{-Wunused-but-set-parameter=3} and
+@option{-Wno-unused-but-set-parameter} is the same as
+@option{-Wunused-but-set-parameter=0}.
+
+@opindex Wunused-but-set-parameter=
+@item -Wunused-but-set-parameter=@var{n}
Warn whenever a function parameter is assigned to, but otherwise unused
(aside from its declaration).
To suppress this warning use the @code{unused} attribute
(@pxref{Variable Attributes}).
-This warning is also enabled by @option{-Wunused} together with
-@option{-Wextra}.
+@option{-Wunused-but-set-parameter=0} disables the warning.
+With @option{-Wunused-but-set-parameter=1} all uses except initialization
+and left hand side of assignment which is not further used disable the
+warning.
+With @option{-Wunused-but-set-parameter=2} additionally uses of parameter
+in @code{++} and @code{--} operators don't count as uses.
+And finally with @option{-Wunused-but-set-parameter=3} additionally
+uses in @var{parm} @code{@var{@@}=} @var{rhs} outside of @var{rhs} don't
+count as uses. See @option{-Wunused-but-set-variable=@var{n}} option for
+examples.
+
+This @option{-Wunused-but-set-parameter=3} warning is also enabled by
+@option{-Wunused} together with @option{-Wextra}.
@opindex Wunused-but-set-variable
@opindex Wno-unused-but-set-variable
@item -Wunused-but-set-variable
+@option{-Wunused-but-set-variable} is the same as
+@option{-Wunused-but-set-variable=3} and
+@option{-Wno-unused-but-set-variable} is the same as
+@option{-Wunused-but-set-variable=0}.
+
+@opindex Wunused-but-set-variable=
+@item -Wunused-but-set-variable=@var{n}
Warn whenever a local variable is assigned to, but otherwise unused
(aside from its declaration).
-This warning is enabled by @option{-Wall}.
+This @option{-Wunused-but-set-variable=3} warning is enabled by @option{-Wall}.
To suppress this warning use the @code{unused} attribute
(@pxref{Variable Attributes}).
-This warning is also enabled by @option{-Wunused}, which is enabled
-by @option{-Wall}.
+@option{-Wunused-but-set-variable=0} disables the warning.
+With @option{-Wunused-but-set-variable=1} all uses except initialization
+and left hand side of assignment which is not further used disable the
+warning.
+With @option{-Wunused-but-set-variable=2} additionally uses of variable
+in @code{++} and @code{--} operators don't count as uses.
+And finally with @option{-Wunused-but-set-variable=3} additionally
+uses in @var{parm} @code{@var{@@}=} @var{rhs} outside of @var{rhs} don't
+count as uses.
+
+This @option{-Wunused-but-set-variable=3} warning is also enabled by
+@option{-Wunused}, which is enabled by @option{-Wall}.
+
+@smallexample
+void foo (void)
+@{
+ int a = 1; // @option{-Wunused-variable} warning
+ int b = 0; // Warning for @var{n} >= 1
+ b = 1; b = 2;
+ int c = 0; // Warning for @var{n} >= 2
+ ++c; c--; --c; c++;
+ int d = 0; // Warning for @var{n} >= 3
+ d += 4;
+ int e = 0; // No warning, cast to void
+ (void) e;
+ int f = 0; // No warning, f used
+ int g = f = 5;
+ (void) g;
+ int h = 0; // No warning, preincrement used
+ int i = ++h;
+ (void) i;
+ int j = 0; // No warning, postdecrement used
+ int k = j--;
+ (void) k;
+ int l = 0; // No warning, l used
+ int m = l |= 2;
+ (void) m;
+@}
+@end smallexample
@opindex Wunused-function
@opindex Wno-unused-function
/* Mask. */
uint64_t mask = 0;
- uint64_t tmp = (1 << BITS_PER_UNIT) - 1;
- for (unsigned i = 0; i < bitsize / BITS_PER_UNIT;
- i++, tmp <<= BITS_PER_UNIT)
+ for (unsigned i = 0; i < bitsize / BITS_PER_UNIT; i++)
mask |= (uint64_t) MARKER_MASK << (i * BITS_PER_MARKER);
n->n &= mask;
const Typed_identifier_list* parameters = fntype->parameters();
if (parameters != NULL)
{
- size_t i = 0;
bool is_varargs = fntype->is_varargs();
bool first = true;
for (Typed_identifier_list::const_iterator p = parameters->begin();
p != parameters->end();
- ++p, ++i)
+ ++p)
{
if (first)
first = false;
TYPE_ATTRIBUTES (TREE_TYPE (nnode->decl)));
}
}
+#else
+ (void) named_args;
#endif
{
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused -Wextra" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=3" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f, /* { dg-warning "parameter 'f' set but not used" } */
+ int g, /* { dg-warning "parameter 'g' set but not used" } */
+ int h, /* { dg-warning "parameter 'h' set but not used" } */
+ int i, /* { dg-warning "parameter 'i' set but not used" } */
+ int j, /* { dg-warning "parameter 'j' set but not used" } */
+ int k, /* { dg-warning "parameter 'k' set but not used" } */
+ int l, /* { dg-warning "parameter 'l' set but not used" } */
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=2" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b, /* { dg-warning "parameter 'b' set but not used" } */
+ int c, /* { dg-warning "parameter 'c' set but not used" } */
+ int d, /* { dg-warning "parameter 'd' set but not used" } */
+ int e, /* { dg-warning "parameter 'e' set but not used" } */
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m) /* { dg-warning "parameter 'm' set but not used" } */
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=1" } */
+
+void baz (int);
+
+void
+foo (int a, /* { dg-warning "parameter 'a' set but not used" } */
+ int b,
+ int c,
+ int d,
+ int e,
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m)
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-parameter=0" } */
+
+void baz (int);
+
+void
+foo (int a,
+ int b,
+ int c,
+ int d,
+ int e,
+ int f,
+ int g,
+ int h,
+ int i,
+ int j,
+ int k,
+ int l,
+ int m)
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=3" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0; /* { dg-warning "variable 'f' set but not used" } */
+ f += 2;
+ int g = 0; /* { dg-warning "variable 'g' set but not used" } */
+ g |= 2;
+ int h = 0; /* { dg-warning "variable 'h' set but not used" } */
+ h -= 2;
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ i &= 2;
+ int j = 0; /* { dg-warning "variable 'j' set but not used" } */
+ j ^= 2;
+ int k = 0; /* { dg-warning "variable 'k' set but not used" } */
+ k *= 2;
+ int l = 0; /* { dg-warning "variable 'l' set but not used" } */
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=2" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0; /* { dg-warning "variable 'b' set but not used" } */
+ ++b;
+ int c = 0; /* { dg-warning "variable 'c' set but not used" } */
+ c++;
+ int d = 0; /* { dg-warning "variable 'd' set but not used" } */
+ --d;
+ int e = 0; /* { dg-warning "variable 'e' set but not used" } */
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0; /* { dg-warning "variable 'm' set but not used" } */
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=1" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0; /* { dg-warning "variable 'a' set but not used" } */
+ a = 1;
+ int b = 0;
+ ++b;
+ int c = 0;
+ c++;
+ int d = 0;
+ --d;
+ int e = 0;
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
--- /dev/null
+/* PR c/44677 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wunused-but-set-variable=0" } */
+
+void baz (int);
+
+void
+foo (void)
+{
+ int a = 0;
+ a = 1;
+ int b = 0;
+ ++b;
+ int c = 0;
+ c++;
+ int d = 0;
+ --d;
+ int e = 0;
+ e--;
+ int f = 0;
+ f += 2;
+ int g = 0;
+ g |= 2;
+ int h = 0;
+ h -= 2;
+ int i = 0;
+ i &= 2;
+ int j = 0;
+ j ^= 2;
+ int k = 0;
+ k *= 2;
+ int l = 0;
+ l %= 2;
+ int m = 0;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
void
bar (void)
{
- int a;
+ int a; /* { dg-warning "set but not used" } */
int b;
int c; /* { dg-warning "set but not used" } */
a = 1;
void
baz (void)
{
- int a;
+ int a; /* { dg-warning "set but not used" } */
int b;
int c;
int d;
++_;
}
{
- static int _ = 3;
+ static int _ = 3; // { dg-warning "variable '_' set but not used" }
++_;
}
{
--- /dev/null
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-parameter" }
+
+void baz (int);
+
+template <int N>
+void
+foo (int a, // { dg-warning "parameter 'a' set but not used" }
+ int b, // { dg-warning "parameter 'b' set but not used" }
+ int c, // { dg-warning "parameter 'c' set but not used" }
+ int d, // { dg-warning "parameter 'd' set but not used" }
+ int e, // { dg-warning "parameter 'e' set but not used" }
+ int f, // { dg-warning "parameter 'f' set but not used" }
+ int g, // { dg-warning "parameter 'g' set but not used" }
+ int h, // { dg-warning "parameter 'h' set but not used" }
+ int i, // { dg-warning "parameter 'i' set but not used" }
+ int j, // { dg-warning "parameter 'j' set but not used" }
+ int k, // { dg-warning "parameter 'k' set but not used" }
+ int l, // { dg-warning "parameter 'l' set but not used" }
+ int m) // { dg-warning "parameter 'm' set but not used" }
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <int N>
+int
+bar (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
+ int k, int l, int m, int n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <0> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ bar <0> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+}
--- /dev/null
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-parameter" }
+
+void baz (int);
+
+template <typename T>
+void
+foo (T a, // { dg-warning "parameter 'a' set but not used" }
+ T b, // { dg-warning "parameter 'b' set but not used" }
+ T c, // { dg-warning "parameter 'c' set but not used" }
+ T d, // { dg-warning "parameter 'd' set but not used" }
+ T e, // { dg-warning "parameter 'e' set but not used" }
+ T f, // { dg-warning "parameter 'f' set but not used" }
+ T g, // { dg-warning "parameter 'g' set but not used" }
+ T h, // { dg-warning "parameter 'h' set but not used" }
+ T i, // { dg-warning "parameter 'i' set but not used" }
+ T j, // { dg-warning "parameter 'j' set but not used" }
+ T k, // { dg-warning "parameter 'k' set but not used" }
+ T l, // { dg-warning "parameter 'l' set but not used" }
+ T m) // { dg-warning "parameter 'm' set but not used" }
+{
+ a = 1;
+ ++b;
+ c++;
+ --d;
+ e--;
+ f += 2;
+ g |= 2;
+ h -= 2;
+ i &= 2;
+ j ^= 2;
+ k *= 2;
+ l %= 2;
+ for (T n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <typename T>
+T
+bar (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j,
+ T k, T l, T m, T n)
+{
+ b = ++a;
+ d = --c;
+ f = e--;
+ h = g++;
+ j = i += 42;
+ l = k *= 4;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <int> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ bar <int> (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+}
}
void
-f2 (int x)
+f2 (int x) // { dg-warning "parameter 'x' set but not used" }
{
- int a = 0;
+ int a = 0; // { dg-warning "variable 'a' set but not used" }
x++;
++a;
}
--- /dev/null
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-variable" }
+
+void baz (int);
+
+template <int N>
+void
+foo (void)
+{
+ int a = 0; // { dg-warning "variable 'a' set but not used" }
+ a = 1;
+ int b = 0; // { dg-warning "variable 'b' set but not used" }
+ ++b;
+ int c = 0; // { dg-warning "variable 'c' set but not used" }
+ c++;
+ int d = 0; // { dg-warning "variable 'd' set but not used" }
+ --d;
+ int e = 0; // { dg-warning "variable 'e' set but not used" }
+ e--;
+ int f = 0; // { dg-warning "variable 'f' set but not used" }
+ f += 2;
+ int g = 0; // { dg-warning "variable 'g' set but not used" }
+ g |= 2;
+ int h = 0; // { dg-warning "variable 'h' set but not used" }
+ h -= 2;
+ int i = 0; // { dg-warning "variable 'i' set but not used" }
+ i &= 2;
+ int j = 0; // { dg-warning "variable 'j' set but not used" }
+ j ^= 2;
+ int k = 0; // { dg-warning "variable 'k' set but not used" }
+ k *= 2;
+ int l = 0; // { dg-warning "variable 'l' set but not used" }
+ l %= 2;
+ int m = 0; // { dg-warning "variable 'm' set but not used" }
+ for (int n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <int N>
+int
+bar (void)
+{
+ int a = 0;
+ int b = ++a;
+ int c = 0;
+ int d = --c;
+ int e = 0;
+ int f = e--;
+ int g = 0;
+ int h = g++;
+ int i = 0;
+ int j;
+ j = i += 42;
+ int k = 0;
+ int l;
+ l = k *= 4;
+ int m = 0;
+ int n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <0> ();
+ bar <0> ();
+}
--- /dev/null
+// PR c/44677
+// { dg-do compile }
+// { dg-options "-O2 -Wunused-but-set-variable" }
+
+void baz (int);
+
+template <typename T>
+void
+foo (void)
+{
+ T a = 0; // { dg-warning "variable 'a' set but not used" }
+ a = 1;
+ T b = 0; // { dg-warning "variable 'b' set but not used" }
+ ++b;
+ T c = 0; // { dg-warning "variable 'c' set but not used" }
+ c++;
+ T d = 0; // { dg-warning "variable 'd' set but not used" }
+ --d;
+ T e = 0; // { dg-warning "variable 'e' set but not used" }
+ e--;
+ T f = 0; // { dg-warning "variable 'f' set but not used" }
+ f += 2;
+ T g = 0; // { dg-warning "variable 'g' set but not used" }
+ g |= 2;
+ T h = 0; // { dg-warning "variable 'h' set but not used" }
+ h -= 2;
+ T i = 0; // { dg-warning "variable 'i' set but not used" }
+ i &= 2;
+ T j = 0; // { dg-warning "variable 'j' set but not used" }
+ j ^= 2;
+ T k = 0; // { dg-warning "variable 'k' set but not used" }
+ k *= 2;
+ T l = 0; // { dg-warning "variable 'l' set but not used" }
+ l %= 2;
+ T m = 0; // { dg-warning "variable 'm' set but not used" }
+ for (T n = 4; n < 10; n++, m++)
+ baz (n);
+}
+
+template <typename T>
+T
+bar (void)
+{
+ T a = 0;
+ T b = ++a;
+ T c = 0;
+ T d = --c;
+ T e = 0;
+ T f = e--;
+ T g = 0;
+ T h = g++;
+ T i = 0;
+ T j;
+ j = i += 42;
+ T k = 0;
+ T l;
+ l = k *= 4;
+ T m = 0;
+ T n;
+ n = m |= 2;
+ return b + d + f + h + j + l + n;
+}
+
+void
+test ()
+{
+ foo <int> ();
+ bar <int> ();
+}
const struct SX sx = { 0x1221 };
const char sx_rep[] = { };
-void test_find (void)
+int test_find (void)
{
int n = 0, nb = (const char*)&sx.a - (const char*)&sx;
const char *p = (const char*)&sx, *q = sx_rep;
n += p + 1 == memchr (p, q[1], nb);
+ return n;
}
/* { dg-do compile } */
/* { dg-options "-Wunused" } */
-
void g(void)
{
- int i = 0;
- volatile int x;
- (x, i++); /* { dg-bogus "set but not used" } */
+ int i = 0; /* { dg-warning "variable 'i' set but not used" } */
+ volatile int x; /* { dg-bogus "variable 'x' set but not used" } */
+ (x, i++);
}
-
-