wahern / dns

dns.c: Single file non-blocking DNS C library without callbacks or external dependencies.
http://25thandclement.com/~william/projects/dns.c.html
MIT License
256 stars 64 forks source link

Don't use typeof (use __typeof__) #16

Closed daurnimator closed 8 years ago

daurnimator commented 8 years ago

Reported by @oerdnj

Only single occurrence: https://github.com/wahern/dns/blob/3a1b379dc8ac7e4238a88662696ca3991727d4f2/src/dns.c#L155

Needs to be ported to cqueues too: https://github.com/wahern/cqueues/blob/ad256dfd63ae90e663abf599b680f89df128c04e/src/lib/dns.c#L155

wahern commented 8 years ago

Just curious, what exactly was the issue? Debian has a hacked GCC that doesn't recognize typeof?

daurnimator commented 8 years ago

Something about it defaulting to strict c99 mode instead of gnu99.

oerdnj commented 8 years ago

@wahern Default Debian packaging scripts for Lua packages (https://pkg-lua.alioth.debian.org/policy.html) is running gcc with some default gcc options that includes -std99, f.e.:

libtool --silent --tag=CC --mode=compile cc -c -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr//include/lua5.2 -I src/ -std=c99 -D_GNU_SOURCE -Wall -Wextra -o /«PKGBUILDDIR»/5.2-cqueues/src/lib/kpoll.lo src/lib/kpoll.c

I could probably hack dh_lua, but it's easier for me to just use __typeof__ in this case as everything else works.