aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-06-15 14:56:32 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-06-15 14:56:32 +0000
commitbe43ab4e01784fedf2cb1eca843783e5eecd3535 (patch)
treebb53c4922fdf27602a271638fead41e6077d92ea
parent4682ae0463c9fcc254fe1c8ede9da9133a9956bc (diff)
downloadgcc-be43ab4e01784fedf2cb1eca843783e5eecd3535.zip
gcc-be43ab4e01784fedf2cb1eca843783e5eecd3535.tar.gz
gcc-be43ab4e01784fedf2cb1eca843783e5eecd3535.tar.bz2
c-opts.c (lang_flags): Update for new spelling of flags.
* c-opts.c (lang_flags): Update for new spelling of flags. (write_langs): Similarly. * c.opt: Specify languages. * opts.h: Remove languages. * opts.sh: Recognise front-end defined languages. ada: * lang.opt: Declare Ada. * misc.c (gnat_init_options): Update. doc: * sourcebuild.texi: Update. f: * lang.opt: Declare F77. java: * lang.opt: Declare Java. * lang.c (java_init_options): Update. treelang: * lang.opt: Declare Treelang. Update. * tree1.c (treelang_init_options): Update. From-SVN: r67976
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/lang.opt24
-rw-r--r--gcc/ada/misc.c2
-rw-r--r--gcc/c-opts.c4
-rw-r--r--gcc/c.opt20
-rw-r--r--gcc/doc/sourcebuild.texi8
-rw-r--r--gcc/f/ChangeLog4
-rw-r--r--gcc/f/lang.opt24
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/lang.c2
-rw-r--r--gcc/java/lang.opt24
-rw-r--r--gcc/opts.h11
-rw-r--r--gcc/opts.sh51
-rw-r--r--gcc/treelang/ChangeLog5
-rw-r--r--gcc/treelang/lang.opt34
-rw-r--r--gcc/treelang/tree1.c2
17 files changed, 103 insertions, 132 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 56d5426..dbdc371 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2003-06-15 Neil Booth <neil@daikokuya.co.uk>
+
+ * c-opts.c (lang_flags): Update for new spelling of flags.
+ (write_langs): Similarly.
+ * c.opt: Specify languages.
+ * opts.h: Remove languages.
+ * opts.sh: Recognise front-end defined languages.
+doc:
+ * sourcebuild.texi: Update.
+
2003-06-15 Andreas Jaeger <aj@suse.de>
* alloc-pool.c: Convert to ISO C90 prototypes.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 740f535..aaadc70 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-15 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang.opt: Declare Ada.
+ * misc.c (gnat_init_options): Update.
+
2003-06-14 Nathan Sidwell <nathan@codesourcery.com>
* utils.c (begin_subprog_body): Adjust init_function_start call.
diff --git a/gcc/ada/lang.opt b/gcc/ada/lang.opt
index 0d5855b..9d8b7ab 100644
--- a/gcc/ada/lang.opt
+++ b/gcc/ada/lang.opt
@@ -18,29 +18,13 @@
; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
-
-; This file is processed by the script opts.sh. It is a database of
-; command line options, with each record separated by a blank line,
-; and each field appearing on its own line. The first field is the
-; command-line switch with the leading "-" removed. All options
-; beginning with "f" or "W" are implicitly assumed to take a "no-"
-; form; this form should not be listed. If you do not want this
-; negative form and you want it to be automatically rejected, add
-; RejectNegative to the second field.
-
-; The second field should contain "Ada". If the switch takes an
-; argument, then you should also specify "Joined" and/or "Separate" to
-; indicate where the argument can appear.
-
-; Comments can appear on their own line anwhere in the file, preceded
-; by a semicolon. Whitespace is permitted before the semicolon.
-
-; For each switch XXX below, an enumeration constant is created by the
-; script opts.sh spelt OPT_XXX, but with all non-alphanumeric
-; characters replaced with an underscore.
+; See c.opt for a description of this file's format.
; Please try to keep this file in ASCII collating order.
+Language
+Ada
+
I
Ada Joined Separate
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c
index 4d171fc..81bc3d9 100644
--- a/gcc/ada/misc.c
+++ b/gcc/ada/misc.c
@@ -294,7 +294,7 @@ gnat_init_options ()
gnat_argv[0] = save_argv[0]; /* name of the command */
gnat_argc = 1;
- return CL_ADA;
+ return CL_Ada;
}
/* Here is the function to handle the compiler error processing in GCC. */
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index f1c87cb4..680c3cb 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -50,7 +50,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
# define TARGET_EBCDIC 0
#endif
-static const int lang_flags[] = {CL_C, CL_OBJC, CL_CXX, CL_OBJCXX};
+static const int lang_flags[] = {CL_C, CL_ObjC, CL_CXX, CL_ObjCXX};
static int saved_lineno;
@@ -1537,7 +1537,7 @@ write_langs (buf, flags)
*buf = '\0';
if (flags & CL_C)
strcat (buf, "C");
- if (flags & CL_OBJC)
+ if (flags & CL_ObjC)
{
if (*buf)
strcat (buf, "/");
diff --git a/gcc/c.opt b/gcc/c.opt
index 6cd9295..f277512 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -29,10 +29,10 @@
; RejectNegative to the second field.
; The second field is a space-separated list of which parts of the
-; compiler recognize the switch. Current valid entries are "C",
-; "ObjC", "C++" and "ObjC++". If the switch takes an argument, then
-; you should also specify "Joined" and/or "Separate" to indicate where
-; the argument can appear.
+; compiler recognize the switch, as declared by "Language" entries.
+; If the switch takes an argument, then you should also specify
+; "Joined" and/or "Separate" to indicate where the argument can
+; appear.
; Comments can appear on their own line anwhere in the file, preceded
; by a semicolon. Whitespace is permitted before the semicolon.
@@ -43,6 +43,18 @@
; Please try to keep this file in ASCII collating order.
+Language
+C
+
+Language
+ObjC
+
+Language
+C++
+
+Language
+ObjC++
+
-help
C ObjC C++ ObjC++
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 0bda374..a079bce 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -450,9 +450,6 @@ Details of source file suffixes for that language and @option{-x
Entries in @code{default_compilers} in @file{gcc.c} for source file
suffixes for that language.
@item
-A bitmask in @file{opts.h} that flags each switch accepted by
-the front end, for example @code{CL_JAVA}.
-@item
Preferably test suites, which may be under @file{gcc/testsuite} or
runtime library directories. FIXME: document somewhere how to write
test suite harnesses.
@@ -605,9 +602,8 @@ Move to the stage directory files not included in @code{stagestuff} in
@item lang.opt
This file registers the set of switches that the front end accepts on
-the command line. The file format is documented in each
-@file{lang.opt} file in the GCC tree. @file{lang.opt} is processed
-by the script @file{opts.sh}.
+the command line. The file format is documented in the file
+@file{c.opt}. These files are processed by the script @file{opts.sh}.
@item lang-options.h
This file provides entries for @code{documented_lang_options} in
@file{toplev.c} describing command-line options the front end accepts
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index ab62160..f1923fa 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,7 @@
+Sun Jun 15 15:56:51 2003 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang.opt: Declare F77.
+
Sat Jun 14 18:13:00 2003 Nathan Sidwell <nathan@codesourcery.com>
* com.c (stor_parm_decls): Adjust init_function_start call.
diff --git a/gcc/f/lang.opt b/gcc/f/lang.opt
index 327556f..c6e453e 100644
--- a/gcc/f/lang.opt
+++ b/gcc/f/lang.opt
@@ -18,29 +18,13 @@
; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
-
-; This file is processed by the script opts.sh. It is a database of
-; command line options, with each record separated by a blank line,
-; and each field appearing on its own line. The first field is the
-; command-line switch with the leading "-" removed. All options
-; beginning with "f" or "W" are implicitly assumed to take a "no-"
-; form; this form should not be listed. If you do not want this
-; negative form and you want it to be automatically rejected, add
-; RejectNegative to the second field.
-
-; The second field should contain "F77". If the switch takes an
-; argument, then you should also specify "Joined" and/or "Separate" to
-; indicate where the argument can appear.
-
-; Comments can appear on their own line anwhere in the file, preceded
-; by a semicolon. Whitespace is permitted before the semicolon.
-
-; For each switch XXX below, an enumeration constant is created by the
-; script opts.sh spelt OPT_XXX, but with all non-alphanumeric
-; characters replaced with an underscore.
+; See c.opt for a description of this file's format.
; Please try to keep this file in ASCII collating order.
+Language
+F77
+
I
F77 Joined
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 37dacc5..e2c5866 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,10 @@
2003-06-15 Neil Booth <neil@daikokuya.co.uk>
+ * lang.opt: Declare Java.
+ * lang.c (java_init_options): Update.
+
+2003-06-15 Neil Booth <neil@daikokuya.co.uk>
+
* lang.c (version_flag): Rename to v_flag to avoid clash w/ toplev.h.
2003-06-14 Neil Booth <neil@daikokuya.co.uk>
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 3ac6fd2..ff20985 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -695,7 +695,7 @@ java_init_options (void)
jcf_path_init ();
- return CL_JAVA;
+ return CL_Java;
}
static bool
diff --git a/gcc/java/lang.opt b/gcc/java/lang.opt
index 166b1b0..e108fb72 100644
--- a/gcc/java/lang.opt
+++ b/gcc/java/lang.opt
@@ -18,29 +18,13 @@
; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
-
-; This file is processed by the script opts.sh. It is a database of
-; command line options, with each record separated by a blank line,
-; and each field appearing on its own line. The first field is the
-; command-line switch with the leading "-" removed. All options
-; beginning with "f" or "W" are implicitly assumed to take a "no-"
-; form; this form should not be listed. If you do not want this
-; negative form and you want it to be automatically rejected, add
-; RejectNegative to the second field.
-
-; The second field should contain "Java". If the switch takes an
-; argument, then you should also specify "Joined" and/or "Separate" to
-; indicate where the argument can appear.
-
-; Comments can appear on their own line anwhere in the file, preceded
-; by a semicolon. Whitespace is permitted before the semicolon.
-
-; For each switch XXX below, an enumeration constant is created by the
-; script opts.sh spelt OPT_XXX, but with all non-alphanumeric
-; characters replaced with an underscore.
+; See c.opt for a description of this file's format.
; Please try to keep this file in ASCII collating order.
+Language
+Java
+
I
Java Joined
diff --git a/gcc/opts.h b/gcc/opts.h
index 340092e..31c6e8e 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -33,18 +33,9 @@ struct cl_option
extern const struct cl_option cl_options[];
extern const unsigned int cl_options_count;
-#define CL_C (1 << 0) /* Only C. */
-#define CL_OBJC (1 << 1) /* Only ObjC. */
-#define CL_CXX (1 << 2) /* Only C++. */
-#define CL_OBJCXX (1 << 3) /* Only ObjC++. */
-#define CL_F77 (1 << 4) /* Only Fortran. */
-#define CL_JAVA (1 << 5) /* Only Java. */
-#define CL_ADA (1 << 6) /* Only Ada. */
-#define CL_TREELANG (1 << 7) /* Only Treelang. */
-#define CL_COMMON (1 << 8) /* Language-independent. */
-
#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. */
+#define CL_COMMON (1 << 27) /* Language-independent. */
#endif
diff --git a/gcc/opts.sh b/gcc/opts.sh
index 3e67060..dbff2f8 100644
--- a/gcc/opts.sh
+++ b/gcc/opts.sh
@@ -42,37 +42,38 @@ ${AWK} '
/^[ \t]*(;|$)/ { next }
/^[^ \t]/ { gsub ("\n", "\034", $0); print }
' "$@" | ${SORT} | ${AWK} '
- function switch_flags (langs, flags)
+ function switch_flags (flags, result)
{
- langs = ":" langs ":"
- gsub( " ", ":", langs)
- flags = "0"
- if (langs ~ ":C:") flags = flags " | CL_C"
- if (langs ~ ":ObjC:") flags = flags " | CL_OBJC"
- if (langs ~ ":C\\+\\+:") flags = flags " | CL_CXX"
- if (langs ~ ":ObjC\\+\\+:") flags = flags " | CL_OBJCXX"
- if (langs ~ ":F77:") flags = flags " | CL_F77"
- if (langs ~ ":Java:") flags = flags " | CL_JAVA"
- if (langs ~ ":Ada:") flags = flags " | CL_ADA"
- if (langs ~ ":Tree:") flags = flags " | CL_TREELANG"
- if (langs ~ ":Common:") flags = flags " | CL_COMMON"
- if (langs ~ ":Joined:") flags = flags " | CL_JOINED"
- if (langs ~ ":Separate:") flags = flags " | CL_SEPARATE"
- if (langs ~ ":RejectNegative:") flags = flags " | CL_REJECT_NEGATIVE"
- sub( "^0 \\| ", "", flags )
- return flags
+ flags = " " flags " "
+ result = "0"
+ for (j = 0; j < n_langs; j++) {
+ if (flags ~ " " langs[j] " ")
+ result = result " | " macros[j]
+ }
+ if (flags ~ " Common ") result = result " | CL_COMMON"
+ if (flags ~ " Joined ") result = result " | CL_JOINED"
+ if (flags ~ " Separate ") result = result " | CL_SEPARATE"
+ if (flags ~ " RejectNegative ") result = result " | CL_REJECT_NEGATIVE"
+ sub( "^0 \\| ", "", result )
+ return result
}
BEGIN {
FS = "\034"
n_opts = 0
+ n_langs = 0
}
# Collect the text and flags of each option into an array
{
- opts[n_opts] = $1
- flags[n_opts] = $2
- n_opts++;
+ if ($1 == "Language") {
+ langs[n_langs] = $2
+ n_langs++;
+ } else {
+ opts[n_opts] = $1
+ flags[n_opts] = $2
+ n_opts++;
+ }
}
# Dump out an enumeration into a .h file, and an array of options into a
@@ -83,7 +84,13 @@ ${AWK} '
comma = ","
print "/* This file is auto-generated by opts.sh. */\n" > h_file
- print "enum opt_code\n{" >> h_file
+ for (i = 0; i < n_langs; i++) {
+ macros[i] = "CL_" langs[i]
+ gsub( "[^A-Za-z0-9_]", "X", macros[i] )
+ s = substr(" ", length (macros[i]))
+ print "#define " macros[i] s " (1 << " i ")" >> h_file
+ }
+ print "\nenum opt_code\n{" >> h_file
print "/* This file is auto-generated by opts.sh. */\n" > c_file
print "#include \"" h_file "\"" >> c_file
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index 73c502b..e749967 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-15 Neil Booth <neil@daikokuya.co.uk>
+
+ * lang.opt: Declare Treelang. Update.
+ * tree1.c (treelang_init_options): Update.
+
2003-06-14 Nathan Sidwell <nathan@codesourcery.com>
* treetree.c (tree_code_create_function_initial): Adjust
diff --git a/gcc/treelang/lang.opt b/gcc/treelang/lang.opt
index 5d3a266..a8fd70b 100644
--- a/gcc/treelang/lang.opt
+++ b/gcc/treelang/lang.opt
@@ -18,42 +18,26 @@
; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
-
-; This file is processed by the script opts.sh. It is a database of
-; command line options, with each record separated by a blank line,
-; and each field appearing on its own line. The first field is the
-; command-line switch with the leading "-" removed. All options
-; beginning with "f" or "W" are implicitly assumed to take a "no-"
-; form; this form should not be listed. If you do not want this
-; negative form and you want it to be automatically rejected, add
-; RejectNegative to the second field.
-
-; The second field should contain "Tree". If the switch takes an
-; argument, then you should also specify "Joined" and/or "Separate" to
-; indicate where the argument can appear.
-
-; Comments can appear on their own line anwhere in the file, preceded
-; by a semicolon. Whitespace is permitted before the semicolon.
-
-; For each switch XXX below, an enumeration constant is created by the
-; script opts.sh spelt OPT_XXX, but with all non-alphanumeric
-; characters replaced with an underscore.
+; See c.opt for a description of this file's format.
; Please try to keep this file in ASCII collating order.
+Language
+Treelang
+
-help
-Tree
+Treelang
flexer-trace
-Tree
+Treelang
fparser-trace
-Tree
+Treelang
v
-Tree
+Treelang
y
-Tree
+Treelang
; This comment is to ensure we retain the blank line above.
diff --git a/gcc/treelang/tree1.c b/gcc/treelang/tree1.c
index 6be21a3..4c1a846 100644
--- a/gcc/treelang/tree1.c
+++ b/gcc/treelang/tree1.c
@@ -92,7 +92,7 @@ static unsigned int work_nesting_level = 0;
int
treelang_init_options (void)
{
- return CL_TREELANG;
+ return CL_Treelang;
}
/* Process a switch - called by opts.c. */