summaryrefslogtreecommitdiff
path: root/gcc/opts.sh
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-15 14:56:32 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-15 14:56:32 +0000
commitedc4d549b817379879c37060d3a5f8ad3293f2ef (patch)
treebb53c4922fdf27602a271638fead41e6077d92ea /gcc/opts.sh
parentaecda0d63740bf543c769e6fed70a34cc7f052e3 (diff)
downloadgcc-edc4d549b817379879c37060d3a5f8ad3293f2ef.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67976 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opts.sh')
-rw-r--r--gcc/opts.sh51
1 files changed, 29 insertions, 22 deletions
diff --git a/gcc/opts.sh b/gcc/opts.sh
index 3e670600d7e..dbff2f8cf31 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