summaryrefslogtreecommitdiff
path: root/gcc/opts.h
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-07-20 20:51:20 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-07-20 14:51:20 -0600
commit00abf86c47606f8220d6508654ef52ef11d76e3d (patch)
tree9fa355c5a990f19e6fa77fffaa11f37da0124134 /gcc/opts.h
parent20e8ceae67be4186c4f20b4fb96f7cfade9853a7 (diff)
PR middle-end/82063 - issues with arguments enabled by -Wall
gcc/ada/ChangeLog: PR middle-end/82063 * gcc-interface/misc.c (gnat_handle_option): Change function argument to HOST_WIDE_INT. gcc/brig/ChangeLog: PR middle-end/82063 * brig/brig-lang.c (brig_langhook_handle_option): Change function argument to HOST_WIDE_INT. gcc/c-family/ChangeLog: PR middle-end/82063 * c-common.h (c_common_handle_option): Change function argument to HOST_WIDE_INT. * c-opts.c (c_common_init_options): Same. (c_common_handle_option): Same. Remove special handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * c.opt (-Walloc-size-larger-than, -Walloca-larger-than): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. (-Wvla-larger-than): Same. (-Wno-alloc-size-larger-than, -Wno-alloca-larger-than): New. (-Wno-vla-larger-than): Same. gcc/fortran/ChangeLog: PR middle-end/82063 * gfortran.h (gfc_handle_option): Change function argument to HOST_WIDE_INT. * options.c (gfc_handle_option): Same. gcc/go/ChangeLog: PR middle-end/82063 * go-lang.c (go_langhook_handle_option): Change function argument to HOST_WIDE_INT. gcc/lto/ChangeLog: PR middle-end/82063 * lto-lang.c (lto_handle_option): Change function argument to HOST_WIDE_INT. gcc/testsuite/ChangeLog: PR middle-end/82063 * gcc/testsuite/c-c++-common/pr68657-1.c: Adjust. * gcc/testsuite/c-c++-common/pr68657-2.c: Same. * gcc/testsuite/c-c++-common/pr68657-3.c: Same. * gcc.dg/Walloc-size-larger-than-16.c: Same. * gcc.dg/Walloca-larger-than.c: New test. * gcc.dg/Walloca-larger-than-2.c: New test. * gcc.dg/Wframe-larger-than-2.c: New test. * gcc.dg/Wlarger-than3.c: New test. * gcc.dg/Wvla-larger-than-3.c: New test. * gcc.dg/pr42611.c: Adjust. * gnat.dg/frame_overflow.adb: Same. gcc/ChangeLog: PR middle-end/82063 * builtins.c (expand_builtin_alloca): Adjust. * calls.c (alloc_max_size): Simplify. * cgraphunit.c (cgraph_node::expand): Adjust. * common.opt (larger_than_size, warn_frame_larger_than): Remove variables. (frame_larger_than_size): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. * doc/invoke.texi (GCC Command Options): Document option arguments. Explain byte-size arguments and suffixes. (-Wvla-larger-than, -Wno-alloc-size-larger-than): Update. (-Wno-alloca-larger-than, -Wno-vla-larger-than): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Same. * doc/options.texi (UInteger): Expand. (Host_Wide_Int, ByteSize): Document new properties. * final.c (final_start_function_1): Include sizes in an error message. * function.c (frame_offset_overflow): Same. * gimple-ssa-warn-alloca.c (pass_walloca::gate): Adjust. (alloca_call_type_by_arg): Change function argument to HOST_WIDE_INT. Diagnose unbounded alloca calls only for limits of less than PTRDIFF_MAX. (alloca_call_type): Adjust. Diagnose possibly out-of-bounds alloca calls and VLA size only for limits of less than PTRDIFF_MAX. Same for alloca(0). (pass_walloca::execute): Adjust. Diagnose alloca calls in loops only for limits of less than PTRDIFF_MAX. * langhooks-def.h (lhd_handle_option): Change function argument to HOST_WIDE_INT. * langhooks.c (lhd_handle_option): Same. * langhooks.h (handle_option): Same. * opt-functions.awk (switch_bit_fields): Handle Host_Wide_Int and ByteSize flags. (var_type, var_type_struct): Same. (var_set): Handle ByteSize flag. * optc-gen.awk: Add comments to output to ease debugging. Make use of HOST_WIDE_INT where appropriate. * opts-gen-save.awk: Use %lx to format unsigned long. * opth-gen.awk: Change function argument to HOST_WIDE_INT. * opts-common.c (integral_argument): Return HOST_WIDE_INT and add arguments. Parse bytes-size suffixes. (enum_arg_to_value): Change function argument to HOST_WIDE_INT. (enum_value_to_arg): Same. (decode_cmdline_option): Handle cl_host_wide_int. Adjust. (handle_option): Adjust. (generate_option): Change function argument to HOST_WIDE_INT. (cmdline_handle_error): Adjust. (read_cmdline_option): Change function argument to HOST_WIDE_INT. (set_option): Change function argument to HOST_WIDE_INT. (option_enabled): Handle cl_host_wide_int. (get_option_state): Handle CLVC_SIZE. (control_warning_option): Same. * opts.c (common_handle_option): Change function argument to HOST_WIDE_INT. Remove handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * opts.h (enum cl_var_type): Add an enumerator. * stor-layout.c (layout_decl): Print a more meaningful warning. * toplev.c (output_stack_usage): Adjust. From-SVN: r262910
Diffstat (limited to 'gcc/opts.h')
-rw-r--r--gcc/opts.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc/opts.h b/gcc/opts.h
index 3723bdbf95b..0091fe0e9b2 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -36,6 +36,9 @@ enum cl_var_type {
/* The switch is enabled when VAR_VALUE is set in FLAG_VAR. */
CLVC_BIT_SET,
+ /* The switch is enabled when FLAG_VAR is less than HOST_WIDE_INT_M1U. */
+ CLVC_SIZE,
+
/* The switch takes a string argument and FLAG_VAR points to that
argument. */
CLVC_STRING,
@@ -70,7 +73,10 @@ struct cl_option
unsigned short back_chain;
/* Option length, not including initial '-'. */
unsigned char opt_len;
- /* Next option in a sequence marked with Negative, or -1 if none. */
+ /* Next option in a sequence marked with Negative, or -1 if none.
+ For a single option with both a negative and a positve form
+ (such as -Wall and -Wno-all), NEG_IDX is equal to the option's
+ own index (i.e., cl_options[IDX].neg_idx == IDX holds). */
int neg_index;
/* CL_* flags for this option. */
unsigned int flags;
@@ -102,6 +108,8 @@ struct cl_option
BOOL_BITFIELD cl_report : 1;
/* Deprecated option */
BOOL_BITFIELD cl_deprecated: 1;
+ /* Argument is an unsigned integer with an optional byte suffix. */
+ BOOL_BITFIELD cl_byte_size: 1;
/* Offset of field for this option in struct gcc_options, or
(unsigned short) -1 if none. */
unsigned short flag_var_offset;
@@ -247,7 +255,7 @@ struct cl_decoded_option
/* For a boolean option, 1 for the true case and 0 for the "no-"
case. For an unsigned integer option, the value of the
argument. 1 in all other cases. */
- int value;
+ HOST_WIDE_INT value;
/* Any flags describing errors detected in this option. */
int errors;
@@ -327,7 +335,7 @@ extern char *opts_concat (const char *first, ...);
extern struct obstack opts_obstack;
size_t find_opt (const char *input, unsigned int lang_mask);
-extern int integral_argument (const char *arg);
+extern HOST_WIDE_INT integral_argument (const char *arg, int * = NULL, bool = false);
extern bool enum_value_to_arg (const struct cl_enum_arg *enum_args,
const char **argp, int value,
unsigned int lang_mask);
@@ -359,16 +367,17 @@ extern bool get_option_state (struct gcc_options *, int,
struct cl_option_state *);
extern void set_option (struct gcc_options *opts,
struct gcc_options *opts_set,
- int opt_index, int value, const char *arg, int kind,
- location_t loc, diagnostic_context *dc);
+ int opt_index, HOST_WIDE_INT value, const char *arg,
+ int kind, location_t loc, diagnostic_context *dc);
extern void *option_flag_var (int opt_index, struct gcc_options *opts);
bool handle_generated_option (struct gcc_options *opts,
struct gcc_options *opts_set,
- size_t opt_index, const char *arg, int value,
+ size_t opt_index, const char *arg,
+ HOST_WIDE_INT value,
unsigned int lang_mask, int kind, location_t loc,
const struct cl_option_handlers *handlers,
bool generated_p, diagnostic_context *dc);
-void generate_option (size_t opt_index, const char *arg, int value,
+void generate_option (size_t opt_index, const char *arg, HOST_WIDE_INT value,
unsigned int lang_mask,
struct cl_decoded_option *decoded);
void generate_option_input_file (const char *file,
@@ -425,7 +434,8 @@ extern void set_struct_debug_option (struct gcc_options *opts,
location_t loc,
const char *value);
extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg,
- int *value, unsigned int lang_mask);
+ int *value,
+ unsigned int lang_mask);
extern const struct sanitizer_opts_s
{