public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with =
@ 2022-04-26 9:42 Martin Liska
0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2022-04-26 9:42 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:07729157ee62a5ac7b415e01250a21e3ed990198
commit 07729157ee62a5ac7b415e01250a21e3ed990198
Author: Martin Liska <mliska@suse.cz>
Date: Tue Apr 26 11:41:09 2022 +0200
opts: do not allow Separate+Joined ending with =
Do not allow strange option format:
-msmall-data-limit= 11.
PR target/105355
gcc/c-family/ChangeLog:
* c.opt: Remove Separate from -output-pch=.
gcc/ChangeLog:
* config/riscv/riscv.opt: Remove Separate from
-msmall-data-limit=.
* optc-gen.awk: Report error for the described situation.
Diff:
---
gcc/c-family/c.opt | 2 +-
gcc/config/riscv/riscv.opt | 2 +-
gcc/optc-gen.awk | 7 +++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 07da40ef43b..873461d1fee 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -136,7 +136,7 @@ C ObjC C++ ObjC++ Separate Alias(o)
C ObjC C++ ObjC++ Joined Alias(o)
-output-pch=
-C ObjC C++ ObjC++ Joined Separate
+C ObjC C++ ObjC++ Joined
-pedantic
C ObjC C++ ObjC++ Alias(pedantic)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 492aad12324..84c8cf5a2de 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -92,7 +92,7 @@ Target RejectNegative Joined Var(riscv_cpu_string)
-mcpu=PROCESSOR Use architecture of and optimize the output for PROCESSOR.
msmall-data-limit=
-Target Joined Separate UInteger Var(g_switch_value) Init(8)
+Target Joined UInteger Var(g_switch_value) Init(8)
-msmall-data-limit=N Put global and static data smaller than <number> bytes into a special section (on some targets).
msave-restore
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index b51688d284f..595d3cff677 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -342,6 +342,13 @@ for (i = 0; i < n_opts; i++) {
len = length (opts[i]);
enum = opt_enum(opts[i])
+ # Do not allow Joined and Separate properties if
+ # an options ends with '='.
+ if (flag_set_p("Joined", flags[i]) && flag_set_p("Separate", flags[i]) && opts[i] ~ "=$") {
+ print "#error Option '" opts[i] "' ending with '=' cannot have " \
+ "both Joined and Separate properties"
+ }
+
# If this switch takes joined arguments, back-chain all
# subsequent switches to it for which it is a prefix. If
# a later switch S is a longer prefix of a switch T, T
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/marxin/heads/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with =
@ 2022-05-09 8:57 Martin Liska
0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2022-05-09 8:57 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e76e6dbd2b235aef080b9782a9a144cb906fe478
commit e76e6dbd2b235aef080b9782a9a144cb906fe478
Author: Martin Liska <mliska@suse.cz>
Date: Tue Apr 26 11:41:09 2022 +0200
opts: do not allow Separate+Joined ending with =
Do not allow strange option format:
-msmall-data-limit= 11.
For -output-pch we need to use Separate syntax as lang spec
rules automatically append a space.
PR target/105355
gcc/ChangeLog:
* config/riscv/riscv.opt: Remove Separate from
-msmall-data-limit=.
* optc-gen.awk: Report error for the described situation.
* gcc.cc: Use Separate syntax.
* opts.cc (gen_command_line_string): Change option name.
gcc/c-family/ChangeLog:
* c-opts.cc (c_common_handle_option): Change option name.
* c.opt: Remove Joined and use Separate option.
gcc/cp/ChangeLog:
* lang-specs.h: Use Separate syntax.
gcc/objc/ChangeLog:
* lang-specs.h: Use Separate syntax.
gcc/objcp/ChangeLog:
* lang-specs.h: Use Separate syntax.
Diff:
---
gcc/c-family/c-opts.cc | 2 +-
gcc/c-family/c.opt | 4 ++--
gcc/config/riscv/riscv.opt | 2 +-
gcc/cp/lang-specs.h | 6 +++---
gcc/gcc.cc | 8 ++++----
gcc/objc/lang-specs.h | 8 ++++----
gcc/objcp/lang-specs.h | 2 +-
gcc/optc-gen.awk | 7 +++++++
gcc/opts.cc | 2 +-
9 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index a341a061758..da377f09bba 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -303,7 +303,7 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
result = false;
break;
- case OPT__output_pch_:
+ case OPT__output_pch:
pch_file = arg;
break;
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 07da40ef43b..035b1de0d84 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -135,8 +135,8 @@ C ObjC C++ ObjC++ Separate Alias(o)
-output=
C ObjC C++ ObjC++ Joined Alias(o)
--output-pch=
-C ObjC C++ ObjC++ Joined Separate
+-output-pch
+C ObjC C++ ObjC++ Separate
-pedantic
C ObjC C++ ObjC++ Alias(pedantic)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 492aad12324..84c8cf5a2de 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -92,7 +92,7 @@ Target RejectNegative Joined Var(riscv_cpu_string)
-mcpu=PROCESSOR Use architecture of and optimize the output for PROCESSOR.
msmall-data-limit=
-Target Joined Separate UInteger Var(g_switch_value) Init(8)
+Target Joined UInteger Var(g_switch_value) Init(8)
-msmall-data-limit=N Put global and static data smaller than <number> bytes into a special section (on some targets).
msave-restore
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index f35c9fab76b..dbda5a7b2e4 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -55,7 +55,7 @@ along with GCC; see the file COPYING3. If not see
" %{!fsyntax-only:"
" %{!S:-o %g.s%V}"
" %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
- " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}"
+ " %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
"}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++-system-header",
@@ -76,7 +76,7 @@ along with GCC; see the file COPYING3. If not see
" %{!fsyntax-only:"
" %{!S:-o %g.s%V}"
" %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
- " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}"
+ " %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
"}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++-user-header",
@@ -96,7 +96,7 @@ along with GCC; see the file COPYING3. If not see
" %{!fsyntax-only:"
" %{!S:-o %g.s%V}"
" %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
- " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}"
+ " %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
"}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++",
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index bb07cc244e3..299e09c4f54 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1462,13 +1462,13 @@ static const struct compiler default_compilers[] =
cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
%(cc1_options)\
%{!fsyntax-only:%{!S:-o %g.s} \
- %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}}%V}}\
+ %{!fdump-ada-spec*:%{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}}%V}}\
%{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
cc1 %(cpp_unique_options) %(cc1_options)\
%{!fsyntax-only:%{!S:-o %g.s} \
- %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
+ %{!fdump-ada-spec*:%{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}}%V}}}}}}}", 0, 0, 0},
{".i", "@cpp-output", 0, 0, 0},
{"@cpp-output",
"%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h
index 1a785ac3a88..049166cb114 100644
--- a/gcc/objc/lang-specs.h
+++ b/gcc/objc/lang-specs.h
@@ -41,12 +41,12 @@ along with GCC; see the file COPYING3. If not see
%eGNU Objective C no longer supports traditional compilation}\
%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}\
+ -o %g.s %{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}%V}\
%{!save-temps*:%{!no-integrated-cpp:\
cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
+ -o %g.s %{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}%V}}}}}", 0, 0, 0},
{".mi", "@objective-c-cpp-output", 0, 0, 0},
{"@objective-c-cpp-output",
"%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
diff --git a/gcc/objcp/lang-specs.h b/gcc/objcp/lang-specs.h
index 2d70f3090f7..49f78a7cdfd 100644
--- a/gcc/objcp/lang-specs.h
+++ b/gcc/objcp/lang-specs.h
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
%{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
%(cc1_options) %2\
- -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+ -o %g.s %{!o*:--output-pch %i.gch} %W{o*:--output-pch %*}%V}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@objective-c++",
"%{E|M|MM:cc1objplus -E %(cpp_options) %2 %(cpp_debug_options)}\
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index b51688d284f..595d3cff677 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -342,6 +342,13 @@ for (i = 0; i < n_opts; i++) {
len = length (opts[i]);
enum = opt_enum(opts[i])
+ # Do not allow Joined and Separate properties if
+ # an options ends with '='.
+ if (flag_set_p("Joined", flags[i]) && flag_set_p("Separate", flags[i]) && opts[i] ~ "=$") {
+ print "#error Option '" opts[i] "' ending with '=' cannot have " \
+ "both Joined and Separate properties"
+ }
+
# If this switch takes joined arguments, back-chain all
# subsequent switches to it for which it is a prefix. If
# a later switch S is a longer prefix of a switch T, T
diff --git a/gcc/opts.cc b/gcc/opts.cc
index 2ffbf429b7b..f9064d8680e 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3611,7 +3611,7 @@ gen_command_line_string (cl_decoded_option *options,
case OPT_SPECIAL_input_file:
case OPT_grecord_gcc_switches:
case OPT_frecord_gcc_switches:
- case OPT__output_pch_:
+ case OPT__output_pch:
case OPT_fdiagnostics_show_location_:
case OPT_fdiagnostics_show_option:
case OPT_fdiagnostics_show_caret:
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/marxin/heads/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with =
@ 2022-05-09 8:56 Martin Liska
0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2022-05-09 8:56 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:69c8d9f0bd4fa7c225e80fac8bdffe94ec87173b
commit 69c8d9f0bd4fa7c225e80fac8bdffe94ec87173b
Author: Martin Liska <mliska@suse.cz>
Date: Tue Apr 26 11:41:09 2022 +0200
opts: do not allow Separate+Joined ending with =
Do not allow strange option format:
-msmall-data-limit= 11.
For -output-pch we need to use Separate syntax as lang spec
rules automatically append a space.
PR target/105355
gcc/c-family/ChangeLog:
* c-opts.cc (c_common_handle_option): Change option name.
* c.opt: Remove Joined and use Separate option.
gcc/ChangeLog:
* config/riscv/riscv.opt: Remove Separate from
-msmall-data-limit=.
* optc-gen.awk: Report error for the described situation.
gcc/cp/ChangeLog:
* lang-specs.h: Use Separate syntax.
gcc/ChangeLog:
* gcc.cc: Use Separate syntax.
* opts.cc (gen_command_line_string): Change option name.
gcc/objc/ChangeLog:
* lang-specs.h: Use Separate syntax.
gcc/objcp/ChangeLog:
* lang-specs.h: Use Separate syntax.
Diff:
---
gcc/c-family/c-opts.cc | 2 +-
gcc/c-family/c.opt | 4 ++--
gcc/config/riscv/riscv.opt | 2 +-
gcc/cp/lang-specs.h | 6 +++---
gcc/gcc.cc | 8 ++++----
gcc/objc/lang-specs.h | 8 ++++----
gcc/objcp/lang-specs.h | 2 +-
gcc/optc-gen.awk | 7 +++++++
gcc/opts.cc | 2 +-
9 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index a341a061758..da377f09bba 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -303,7 +303,7 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
result = false;
break;
- case OPT__output_pch_:
+ case OPT__output_pch:
pch_file = arg;
break;
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 07da40ef43b..035b1de0d84 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -135,8 +135,8 @@ C ObjC C++ ObjC++ Separate Alias(o)
-output=
C ObjC C++ ObjC++ Joined Alias(o)
--output-pch=
-C ObjC C++ ObjC++ Joined Separate
+-output-pch
+C ObjC C++ ObjC++ Separate
-pedantic
C ObjC C++ ObjC++ Alias(pedantic)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 492aad12324..84c8cf5a2de 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -92,7 +92,7 @@ Target RejectNegative Joined Var(riscv_cpu_string)
-mcpu=PROCESSOR Use architecture of and optimize the output for PROCESSOR.
msmall-data-limit=
-Target Joined Separate UInteger Var(g_switch_value) Init(8)
+Target Joined UInteger Var(g_switch_value) Init(8)
-msmall-data-limit=N Put global and static data smaller than <number> bytes into a special section (on some targets).
msave-restore
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index f35c9fab76b..dbda5a7b2e4 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -55,7 +55,7 @@ along with GCC; see the file COPYING3. If not see
" %{!fsyntax-only:"
" %{!S:-o %g.s%V}"
" %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
- " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}"
+ " %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
"}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++-system-header",
@@ -76,7 +76,7 @@ along with GCC; see the file COPYING3. If not see
" %{!fsyntax-only:"
" %{!S:-o %g.s%V}"
" %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
- " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}"
+ " %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
"}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++-user-header",
@@ -96,7 +96,7 @@ along with GCC; see the file COPYING3. If not see
" %{!fsyntax-only:"
" %{!S:-o %g.s%V}"
" %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:"
- " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}"
+ " %{!o*:--output-pch %i.gch}%W{o*:--output-pch %*}}}}}"
"}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@c++",
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index bb07cc244e3..299e09c4f54 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1462,13 +1462,13 @@ static const struct compiler default_compilers[] =
cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
%(cc1_options)\
%{!fsyntax-only:%{!S:-o %g.s} \
- %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}}%V}}\
+ %{!fdump-ada-spec*:%{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}}%V}}\
%{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
cc1 %(cpp_unique_options) %(cc1_options)\
%{!fsyntax-only:%{!S:-o %g.s} \
- %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
+ %{!fdump-ada-spec*:%{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}}%V}}}}}}}", 0, 0, 0},
{".i", "@cpp-output", 0, 0, 0},
{"@cpp-output",
"%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h
index 1a785ac3a88..049166cb114 100644
--- a/gcc/objc/lang-specs.h
+++ b/gcc/objc/lang-specs.h
@@ -41,12 +41,12 @@ along with GCC; see the file COPYING3. If not see
%eGNU Objective C no longer supports traditional compilation}\
%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}\
+ -o %g.s %{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}%V}\
%{!save-temps*:%{!no-integrated-cpp:\
cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
- -o %g.s %{!o*:--output-pch=%i.gch}\
- %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
+ -o %g.s %{!o*:--output-pch %i.gch}\
+ %W{o*:--output-pch %*}%V}}}}}", 0, 0, 0},
{".mi", "@objective-c-cpp-output", 0, 0, 0},
{"@objective-c-cpp-output",
"%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
diff --git a/gcc/objcp/lang-specs.h b/gcc/objcp/lang-specs.h
index 2d70f3090f7..49f78a7cdfd 100644
--- a/gcc/objcp/lang-specs.h
+++ b/gcc/objcp/lang-specs.h
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
%{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
%(cc1_options) %2\
- -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+ -o %g.s %{!o*:--output-pch %i.gch} %W{o*:--output-pch %*}%V}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@objective-c++",
"%{E|M|MM:cc1objplus -E %(cpp_options) %2 %(cpp_debug_options)}\
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index b51688d284f..595d3cff677 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -342,6 +342,13 @@ for (i = 0; i < n_opts; i++) {
len = length (opts[i]);
enum = opt_enum(opts[i])
+ # Do not allow Joined and Separate properties if
+ # an options ends with '='.
+ if (flag_set_p("Joined", flags[i]) && flag_set_p("Separate", flags[i]) && opts[i] ~ "=$") {
+ print "#error Option '" opts[i] "' ending with '=' cannot have " \
+ "both Joined and Separate properties"
+ }
+
# If this switch takes joined arguments, back-chain all
# subsequent switches to it for which it is a prefix. If
# a later switch S is a longer prefix of a switch T, T
diff --git a/gcc/opts.cc b/gcc/opts.cc
index 2ffbf429b7b..f9064d8680e 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -3611,7 +3611,7 @@ gen_command_line_string (cl_decoded_option *options,
case OPT_SPECIAL_input_file:
case OPT_grecord_gcc_switches:
case OPT_frecord_gcc_switches:
- case OPT__output_pch_:
+ case OPT__output_pch:
case OPT_fdiagnostics_show_location_:
case OPT_fdiagnostics_show_option:
case OPT_fdiagnostics_show_caret:
^ permalink raw reply [flat|nested] 4+ messages in thread
* [gcc(refs/users/marxin/heads/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with =
@ 2022-05-09 8:54 Martin Liska
0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2022-05-09 8:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:895c28d593b3d67817932a8aae6c00bd3b2df17b
commit 895c28d593b3d67817932a8aae6c00bd3b2df17b
Author: Martin Liska <mliska@suse.cz>
Date: Tue Apr 26 11:41:09 2022 +0200
opts: do not allow Separate+Joined ending with =
Do not allow strange option format:
-msmall-data-limit= 11.
PR target/105355
gcc/c-family/ChangeLog:
* c.opt: Remove Separate from -output-pch=.
gcc/ChangeLog:
* config/riscv/riscv.opt: Remove Separate from
-msmall-data-limit=.
* optc-gen.awk: Report error for the described situation.
Diff:
---
gcc/c-family/c.opt | 2 +-
gcc/config/riscv/riscv.opt | 2 +-
gcc/optc-gen.awk | 7 +++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 07da40ef43b..873461d1fee 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -136,7 +136,7 @@ C ObjC C++ ObjC++ Separate Alias(o)
C ObjC C++ ObjC++ Joined Alias(o)
-output-pch=
-C ObjC C++ ObjC++ Joined Separate
+C ObjC C++ ObjC++ Joined
-pedantic
C ObjC C++ ObjC++ Alias(pedantic)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 492aad12324..84c8cf5a2de 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -92,7 +92,7 @@ Target RejectNegative Joined Var(riscv_cpu_string)
-mcpu=PROCESSOR Use architecture of and optimize the output for PROCESSOR.
msmall-data-limit=
-Target Joined Separate UInteger Var(g_switch_value) Init(8)
+Target Joined UInteger Var(g_switch_value) Init(8)
-msmall-data-limit=N Put global and static data smaller than <number> bytes into a special section (on some targets).
msave-restore
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index b51688d284f..595d3cff677 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -342,6 +342,13 @@ for (i = 0; i < n_opts; i++) {
len = length (opts[i]);
enum = opt_enum(opts[i])
+ # Do not allow Joined and Separate properties if
+ # an options ends with '='.
+ if (flag_set_p("Joined", flags[i]) && flag_set_p("Separate", flags[i]) && opts[i] ~ "=$") {
+ print "#error Option '" opts[i] "' ending with '=' cannot have " \
+ "both Joined and Separate properties"
+ }
+
# If this switch takes joined arguments, back-chain all
# subsequent switches to it for which it is a prefix. If
# a later switch S is a longer prefix of a switch T, T
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-09 8:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 9:42 [gcc(refs/users/marxin/heads/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with = Martin Liska
2022-05-09 8:54 Martin Liska
2022-05-09 8:56 Martin Liska
2022-05-09 8:57 Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).