Commit 50431bc4 by Zdenek Dvorak Committed by Zdenek Dvorak

Makefile.in (FLAGS_H): New.

	* Makefile.in (FLAGS_H): New.
	(flags.h): Replace by FLAGS_H.
	* c.opt: Document Var, VarExists, Init and Report attributes.
	* common.opt: Fill the values of the attributes.
	* diagnostic.c (flag_fatal_errors): Do not define.
	* except.c (flag_non_call_exceptions): Do not define.
	* flags.h: Include options.h.  Remove declarations conflicting with
	the automatically defined ones.
	* opts.c: Remove automatically defined variables.
	(handle_option): Perform default initialization.
	(common_handle_option): Do not handle options covered by the
	default initialization.
	* opts.h (struct cl_option): Add flag_var, has_set_value and set_value
	fields.
	(CL_REPORT): New.
	* opts.sh: Generate variable declarations, handle CL_REPORT.
	* toplev.c: Remove automatically defined variables.
	(f_options): Removed.
	(print_switch_values): Use cl_options instead of f_options.
	* toplev.h (version_flag): Declaration removed.

From-SVN: r83105
parent 966389ee
2004-06-14 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* Makefile.in (FLAGS_H): New.
(flags.h): Replace by FLAGS_H.
* c.opt: Document Var, VarExists, Init and Report attributes.
* common.opt: Fill the values of the attributes.
* diagnostic.c (flag_fatal_errors): Do not define.
* except.c (flag_non_call_exceptions): Do not define.
* flags.h: Include options.h. Remove declarations conflicting with
the automatically defined ones.
* opts.c: Remove automatically defined variables.
(handle_option): Perform default initialization.
(common_handle_option): Do not handle options covered by the
default initialization.
* opts.h (struct cl_option): Add flag_var, has_set_value and set_value
fields.
(CL_REPORT): New.
* opts.sh: Generate variable declarations, handle CL_REPORT.
* toplev.c: Remove automatically defined variables.
(f_options): Removed.
(print_switch_values): Use cl_options instead of f_options.
* toplev.h (version_flag): Declaration removed.
2004-06-14 Ian Lance Taylor <ian@wasabisystems.com>
* config/sparc/sparc.h: Correct comment about availability of
......
......@@ -36,7 +36,14 @@
; "JoinedOrMissing" instead of "Joined". If the argument to a switch
; is a non-negative integer, you can specify "UInteger" and the switch
; decoder will convert the argument for you, or complain to the user
; if the argument is invalid.
; if the argument is invalid. "Var(name,set)" creates an integer
; variable "name". The variable is declared and initialized to value
; given by "Init(value)" (or zero if this property is not defined).
; When the option is passed to compiler, this variable is set to "set"
; if value passed through the flag is nonzero, !"set" if value is zero,
; or to value if "set" is omitted. If "VarExists" is specified, the
; declaration for the variable is not created. If "Report" is specified,
; the flag is output with -fverbose-asm.
; The third field is the help text to output with --help. This is
; automatically line-wrapped on output. Normally the switch is output
......
......@@ -68,7 +68,6 @@ diagnostic_context *global_dc = &global_diagnostic_context;
with preprocessed source if appropriate.\n\
See %s for instructions.\n"
int flag_fatal_errors = 0;
/* Return a malloc'd string containing MSG formatted a la printf. The
caller is responsible for freeing the memory. */
......
......@@ -82,9 +82,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#endif
/* Nonzero means enable synchronous exceptions for non-call instructions. */
int flag_non_call_exceptions;
/* Protect cleanup actions with must-not-throw regions, with a call
to the given failure handler. */
tree (*lang_protect_cleanup_actions) (void);
......
......@@ -23,6 +23,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#ifndef GCC_FLAGS_H
#define GCC_FLAGS_H
#include "options.h"
enum debug_info_type
{
NO_DEBUG, /* Write no debug info. */
......@@ -78,80 +80,26 @@ extern int quiet_flag;
extern int mem_report;
/* Don't print warning messages. -w. */
extern bool inhibit_warnings;
/* Don't suppress warnings from system headers. -Wsystem-headers. */
extern bool warn_system_headers;
/* Do print extra warnings (such as for uninitialized variables).
-W/-Wextra. */
extern bool extra_warnings;
/* If -Werror. */
extern bool warnings_are_errors;
/* Nonzero to warn about unused variables, functions et.al. Use
set_Wunused() to update the -Wunused-* flags that correspond to the
-Wunused option. */
extern void set_Wunused (int setting);
extern bool warn_unused_function;
extern bool warn_unused_label;
extern bool warn_unused_parameter;
extern bool warn_unused_variable;
extern bool warn_unused_value;
/* Nonzero to warn about code which is never reached. */
extern bool warn_notreached;
/* Nonzero means warn if inline function is too large. */
extern bool warn_inline;
/* Nonzero to warn about variables used before they are initialized. */
extern int warn_uninitialized;
/* Nonzero means warn about all declarations which shadow others. */
extern bool warn_shadow;
/* Warn if a switch on an enum, that does not have a default case,
fails to have a case for every enum value. */
extern bool warn_switch;
/* Warn if a switch does not have a default case. */
extern bool warn_switch_default;
/* Warn if a switch on an enum fails to have a case for every enum
value (regardless of the presence or otherwise of a default case). */
extern bool warn_switch_enum;
/* Nonzero means warn about function definitions that default the return type
or that use a null return and have a return-type other than void. */
extern int warn_return_type;
/* Warn about functions which might be candidates for attribute noreturn. */
extern bool warn_missing_noreturn;
/* Nonzero means warn about pointer casts that increase the required
alignment of the target type (and might therefore lead to a crash
due to a misaligned access). */
extern bool warn_cast_align;
/* Nonzero means warn about any objects definitions whose size is larger
than N bytes. Also want about function definitions whose returned
values are larger than N bytes. The value N is in `larger_than_size'. */
......@@ -159,28 +107,6 @@ extern bool warn_cast_align;
extern bool warn_larger_than;
extern HOST_WIDE_INT larger_than_size;
/* Warn if a function returns an aggregate,
since there are often incompatible calling conventions for doing this. */
extern bool warn_aggregate_return;
/* Warn if packed attribute on struct is unnecessary and inefficient. */
extern bool warn_packed;
/* Warn when gcc pads a structure to an alignment boundary. */
extern bool warn_padded;
/* Warn when an optimization pass is disabled. */
extern bool warn_disabled_optimization;
/* Nonzero means warn about uses of __attribute__((deprecated))
declarations. */
extern bool warn_deprecated_decl;
/* Nonzero means warn about constructs which might not be strict
aliasing safe. */
......
......@@ -31,12 +31,16 @@ struct cl_option
unsigned short back_chain;
unsigned char opt_len;
unsigned int flags;
int *flag_var;
int has_set_value;
int set_value;
};
extern const struct cl_option cl_options[];
extern const unsigned int cl_options_count;
extern const char *const lang_names[];
#define CL_REPORT (1 << 23) /* Report argument with -fverbose-asm */
#define CL_JOINED (1 << 24) /* If takes joined argument. */
#define CL_SEPARATE (1 << 25) /* If takes a separate argument. */
#define CL_REJECT_NEGATIVE (1 << 26) /* Reject no- form. */
......
......@@ -66,9 +66,43 @@ ${AWK} '
if (flags ~ " RejectNegative ") result = result " | CL_REJECT_NEGATIVE"
if (flags ~ " UInteger ") result = result " | CL_UINTEGER"
if (flags ~ " Undocumented ") result = result " | CL_UNDOCUMENTED"
if (flags ~ " Report ") result = result " | CL_REPORT"
sub( "^0 \\| ", "", result )
return result
}
function var_args(flags)
{
if (flags !~ "Var\\(")
return "";
sub(".*Var\\(", "", flags);
sub(").*", "", flags);
return flags;
}
function var_name(flags)
{
s = var_args(flags);
if (s == "")
return "";
sub( ",.*", "", s);
return s;
}
function var_set(flags)
{
s = var_args(flags);
if (s !~ ",")
return "0, 0";
sub( "[^,]*,", "", s);
return "1, " s;
}
function var_ref(flags)
{
name = var_name(flags);
if (name == "")
return "0";
else
return "&" name;
}
BEGIN {
FS = "\034"
......@@ -101,9 +135,38 @@ ${AWK} '
print "#include <intl.h>" >> c_file
print "#include \"" realh_file "\"" >> c_file
print "#include \"opts.h\"\n" >> c_file
print "const char * const lang_names[] =\n{" >> c_file
print "/* This file is auto-generated by opts.sh. */\n" > h_file
print "#ifndef OPTIONS_H" >> h_file
print "#define OPTIONS_H\n" >> h_file
for (i = 0; i < n_opts; i++) {
name = var_name(flags[i]);
if (name == "")
continue;
printf ("/* Set by -%s.\n %s */\nextern int %s;\n\n",
opts[i], help[i], name) >> h_file
if (flags[i] ~ "VarExists")
continue;
if (flags[i] ~ "Init\\(")
{
init = flags[i];
sub(".*Init\\(","",init);
sub("\\).*","",init);
init = " = " init;
}
else
init = "";
printf ("/* Set by -%s.\n %s */\nint %s%s;\n\n",
opts[i], help[i], name,init) >> c_file
}
print "const char * const lang_names[] =\n{" >> c_file
for (i = 0; i < n_langs; i++) {
macros[i] = "CL_" langs[i]
gsub( "[^A-Za-z0-9_]", "X", macros[i] )
......@@ -114,6 +177,7 @@ ${AWK} '
print " 0\n};\n" >> c_file
print "const unsigned int cl_options_count = N_OPTS;\n" >> c_file
print "const struct cl_option cl_options[] =\n{" >> c_file
print "\nenum opt_code\n{" >> h_file
......@@ -159,12 +223,14 @@ ${AWK} '
hlp = "N_(\"" help[i] "\")";
printf(" %s,%s/* -%s */\n", enum, s, opts[i]) >> h_file
printf(" { \"-%s\",\n %s,\n %s, %u, %s }%s\n",
printf(" { \"-%s\",\n %s,\n %s, %u, %s, %s, %s }%s\n",
opts[i], hlp, back_chain[i], len,
switch_flags(flags[i]), comma) >> c_file
switch_flags(flags[i]),
var_ref(flags[i]), var_set(flags[i]), comma) >> c_file
}
print " N_OPTS\n};" >> h_file
print " N_OPTS\n};\n" >> h_file
print "#endif /* OPTIONS_H */" >> h_file
print "};" >> c_file
}
'
......
......@@ -104,7 +104,6 @@ extern const char *aux_base_name;
extern const char *aux_info_file_name;
extern const char *asm_file_name;
extern bool exit_after_options;
extern bool version_flag;
extern int target_flags_explicit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment