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: Wed, 05 Jun 2019 19:06:40 -0700 Organization: None to speak of Lines: 31 Message-ID: References: <87ftop38c1.fsf@bsb.me.uk> <98193656-76f0-4718-9a97-a24ba0aa9b7c@googlegroups.com> <4ff90bb7-33e5-4dcd-828f-b0d40f237420@googlegroups.com> <8a72685f-2774-4187-98bf-c9ecd44b3240@googlegroups.com> <6ed2dfc1-a737-4fb3-b59a-3aa1c337061d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="0ad8b66ef2f1a8fe8c740ae2f33d0263"; logging-data="7672"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KfVDKt26q29XNxjbooSy2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:ivy65l9WhrVKODlOOgfaszElKqM= sha1:ZpzIBXCuTX/N7B36t5AvI0XzpYE= Xref: csiph.com comp.lang.c:144512 James Kuyper writes: > On 6/5/19 7:09 PM, Keith Thompson wrote: > ... >> rule). But if you're writing code that depends on POSIX features, >> you're probably not going to use "-std=c11 -pedantic". > > But you might use > > -std=c11 -pedantic -D_POSIX_C_SOURCE=200809L I still get the warning, and using "-std=gnu11" doesn't turn it off: $ cat c.c #include int main(void) { int (*ptr)(void) = (int(*)(void))dlsym((void*)0, "foo"); } $ gcc -std=c11 -pedantic -D_POSIX_C_SOURCE=200809L c.c -ldl -o c c.c: In function ‘main’: c.c:3:24: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic] int (*ptr)(void) = (int(*)(void))dlsym((void*)0, "foo"); ^ $ (dlsym() isn't going to returning anything meaningful with those arguments; the point is the compile-time diagnostics.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */