Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Abstract Syntax Tree for C programs Date: Mon, 27 May 2019 18:41:44 -0700 Organization: None to speak of Lines: 57 Message-ID: References: <1727e4f9-2056-4357-8572-599c46db6a88@googlegroups.com> <17344bb7-9c96-47eb-b006-c6c2e2b8bc59@googlegroups.com> <97b08cce-ec5d-4052-9338-0026b5d449bf@googlegroups.com> <87sgt339na.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="96c016763d4b95fce0489d64fdbdb2d7"; logging-data="12383"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OBYrR0wnQBiRZ+vr93yuU" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ZaOpOuJ2nKV6HctG/7aXY2jyLgI= sha1:MQ02lMbiKdCENJDf+w5EQnwWMGg= Xref: csiph.com comp.lang.c:144053 Bart writes: [...] > I said that the rules about requiring ";" after "}" seem inconsistent > at file scope. > > And I said I had some difficulty in getting my 8 C compilers to report > an extra semicolon in that context. I still can't with 6 out of 8. > > So they were observations. > > You said you wanted a list; apart from gcc and clang, they are: > > msvc > pellec c > dmc > lccwin > tiny y > bcc > > (The last is mine and I can tell you there are no such options.) > > With gcc and clang, I used these options, which yielded a warning > (these just live in an @ file I use when I want stricter compiling): > > -Wall -Wextra -ansi -pedantic -Wformat-nonliteral -Wcast-align > -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes > -Wstrict-prototypes -Wmissing-declarations -Winline -Wundef > -Wnested-externs -Wcast-qual -Wshadow -Wconversion -Wwrite-strings > -Wno-conversion -ffloat-store -O2 -std=c11 As discussed, only "-pedantic" is needed to enable a diagnostic for gcc and clang. For Pelles C, the "/W2" option produces a diagnostic for the extra semicolon. I don't believe Tiny C (assuming that's what you meant) is able to diagnose it. tcc's author does not claim that it's fully conforming. I wasn't able to find an option for lccwin; "-ansic" doesn't do it, at least with the version I have. I also wasn't able to find such an option for dmc; "-A99" didn't do it. In both cases, there could be options I missed. > This is the test code, a file containing: > > void F(void){}; void G(void){}; > int main(void) You forgot the "{}" for main. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */