tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Small patch for function definitions


From: Mauro Antonio Persano
Subject: [Tinycc-devel] Small patch for function definitions
Date: Tue, 8 Jul 2003 00:56:27 -0300

Howdy,

The small patch below rejects abstract parameter declarations in function 
definitions (e.g. `void foo(int, int (*)[]) { }').

This, and the typedef patch in my previous e-mail, should take care of 
some of the problems reported by others in this mailing list (e.g. in
http://mail.gnu.org/archive/html/tinycc-devel/2003-07/msg00001.html).

Thanks,

    Mauro



diff -ruN tcc-0.9.19/tcc.c tcc-0.9.19-new/tcc.c
--- tcc-0.9.19/tcc.c    Sat May 24 14:30:29 2003
+++ tcc-0.9.19-new/tcc.c    Mon Jul  7 23:42:47 2003
@@ -8505,6 +8505,11 @@
                     error("cannot use local functions");
                 if (!(type.t & VT_FUNC))
                     expect("function definition");
+               /* reject abstract declarators in function definition */
+                sym = type.ref;
+                while ((sym = sym->next) != NULL)
+                    if (!(sym->v & ~SYM_FIELD))
+                       expect("identifier");
                 /* XXX: cannot do better now: convert extern line to static
inline */
                 if ((type.t & (VT_EXTERN | VT_INLINE)) == (VT_EXTERN |
VT_INLINE))
                     type.t = (type.t & ~VT_EXTERN) | VT_STATIC;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]