ref: 4b4f06be34425576458f964a3279ab9d579128d5
parent: 5398bfe4e68b7926f301beb47299a92ff0540c10
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jul 5 04:35:20 EDT 2016
[cc1] Fix function alike macro without arguments This case was not tested and there was an error parsing this case, because we were checking yytoken, but in this case we are still in '(', because cpp.c:parameter pass to the next token before checking.
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -163,7 +163,9 @@
n = 0;
argp = buffer;
arglen = INPUTSIZ;
- if (yytoken != ')') {
+ if (ahead() == ')') {
+ next();
+ } else {
do {
*listp++ = argp;
parameter();
--- /dev/null
+++ b/cc1/tests/test064.c
@@ -1,0 +1,32 @@
+/* See LICENSE file for copyright and license details. */
+
+/*
+name: TEST064
+description: Test function alike macro without parenthesis
+error:
+output:
+G5 I F "main
+{
+\
+S1 " #N2 #N1
+M2 I "f #N0
+A6 S1 "s
+ A6 M2 .I #I0 :I
+ h A6 M2 .I
+}
+*/
+
+#define x f
+#define y() f
+
+typedef struct { int f; } S;
+
+int
+main()
+{
+ S s;
+
+ s.x = 0;
+ return s.y();
+}
+