]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390: avoid peeking eof after __vector
authorJiufu Guo <guojiufu@linux.ibm.com>
Wed, 27 Mar 2024 06:15:40 +0000 (14:15 +0800)
committerguojiufu <guojiufu@linux.ibm.com>
Sun, 28 Apr 2024 03:38:47 +0000 (11:38 +0800)
Same like PR101168, it is need for s390 to
avoid peeking eof after vector keyword.
And similar test case is also ok for s390.

PR target/95782

gcc/ChangeLog:

* config/s390/s390-c.cc (s390_macro_to_expand): Avoid empty identifier.

gcc/testsuite/ChangeLog:

* g++.target/s390/pr95782.C: New test.

gcc/config/s390/s390-c.cc
gcc/testsuite/g++.target/s390/pr95782.C [new file with mode: 0644]

index 1bb6e8107667ae70bd215c62cbcb19823a1af954..4521a86f0480a047168c563cdb44bdbd750da2ab 100644 (file)
@@ -275,7 +275,9 @@ s390_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
       /* __vector long __bool a; */
       if (ident == C_CPP_HASHNODE (__bool_keyword))
        expand_bool_p = true;
-      else
+
+      /* If there are more tokens to check.  */
+      else if (ident)
        {
          /* Triggered with: __vector long long __bool a; */
          do
diff --git a/gcc/testsuite/g++.target/s390/pr95782.C b/gcc/testsuite/g++.target/s390/pr95782.C
new file mode 100644 (file)
index 0000000..daf887f
--- /dev/null
@@ -0,0 +1,5 @@
+// { dg-do compile }
+// { dg-options "-march=z14 -mzvector" }
+
+using vdbl =  __vector double;
+#define BREAK 1