This is just a simple check to see if the flags like LangEnabledBy
have the correct case. By putting everything into upper case and
seeing if there is a match (if previously there was not a match).
This would have caught PR 120078 much earlier.
Tested both with and without the fix for PR 120078.

gcc/ChangeLog:

        * opt-functions.awk (opt_args): Print an error
        if there is no match for NAME but there is a match
        for different case name.

Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
---
 gcc/opt-functions.awk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 96ba21347ef..ee8447b301e 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -55,11 +55,21 @@ function flag_init(regex, flags)
 
 # If FLAGS contains a "NAME(...argument...)" flag, return the value
 # of the argument.  Return the empty string otherwise.
+# prints an error message if NAME is in the wrong case in flags
 function opt_args(name, flags)
 {
        flags = " " flags
        if (flags !~ " " name "\\(")
+       {
+               nameu = toupper (name)
+               if (nameu != name)
+               {
+                       flagsu = toupper (flags)
+                       if (flagsu ~ " " nameu "\\(")
+                               print "#error incorrect case of '" name "' 
during parsing of " flags
+               }
                return ""
+       }
        sub(".* " name "\\(", "", flags)
        if (flags ~ "^[{]")
        {
-- 
2.43.0

Reply via email to