-
Notifications
You must be signed in to change notification settings - Fork 870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch from gnu99 to c99. #52
Conversation
Statement expression is GNU C extension, not present in ISO standard. Type checking works now via implicit conversion performed for compound literal (compound literals are available since C99). typeof is only used on GNUC compilers like gcc or clang.
__typeof adheres to ISO C standard as it is reserved identifier [1], so it is collision-free and works in non-GNU mode as long as compiler supports it. [1] C99: "All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use."
Use _XOPEN_SOURCE=600 to make system headers expose Single UNIX Specification v3 (SUSv3) definitions, i.e. POSIX.1-2001 base specification plus the X/Open System Interface (XSI) extension. POSIX.1-2001 is aligned with C99, so that all of the library functions standardized in C99 are also standardized in POSIX.1-2001. Use _BSD_SOURCE together with _DEFAULT_SOURCE to compile without warnings in glibc <= 2.19 and glibc >= 2.20 (_BSD_SOURCE is deprecated since glibc 2.20 and it has same effect as defining _DEFAULT_SOURCE but generates a compile-time warning if used alone). This is required for availability of non-POSIX functions, like inet_aton() or timercmp(), that are present on most BSD derivatives. Note: _DEFAULT_SOURCE, which was introduced in glibc 2.19, will actually bump _POSIX_C_SOURCE from 200112L to 200809L, but it brings no harm.
@przemoc thanks for these changes. I've integrated it in my fork. |
I'm removing my fork, as this is the only pull request not merged by @darkk. PR will remain valid, though. |
@przemoc excuse me for missing this PR. It seems to be ok to me. |
I hope you were not forced to drop your repo like goagent and shadowsocks-windows… |
No, no. I'm just doing some late summer cleanings as I haven't been active redsocks user for some time. IMHO forks that are no longer source for fresh stuff (and all their feature branches were already converted into pull requests upstream) should be deleted, to not clutter the forkspace. Thanks to your message on ML I'm now aware of redsocks2 at semigodking/redsocks. I may look closer at in one day. Short glimpse revealed, though, that many changes weren't introduced as cleanly as I would like them to be, i.e. with proper description and commit granularity, so they're not that nice to follow and it may be easier to just look at the current master than discover all the fixes and improvements through commit log with patches. |
There was a bad attempt (bad meant as taking wrong approach) at removing gnu99 (along with
-Wall
, which definitely shouldn't be removed) in pull #51 and when I saw it almost month ago I just had to do things properly, i.e. perform switch from gnu99 to C99 instead. But because I was doing other things simultaneously back then I forgot to push it in the end. So here it is, finally.