Skip to content
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

Requires CFLAGS='-std=gnu99' to compile on at least CentOS 5.11 #1

Closed
joakimfors opened this issue Dec 22, 2014 · 5 comments
Closed

Comments

@joakimfors
Copy link

Don't know if you want these trivial issues. However, Ntimed requires CFLAGS='-std=gnu99' to compile on CentOS 5.11 with gcc 4.11. Otherwise it complains about missing NAN:

$ make
cc -Wall -Werror   -c -o combine_delta.o combine_delta.c
combine_delta.c: In function ‘CD_AddSource’:
combine_delta.c:204: error: ‘NAN’ undeclared (first use in this function)
combine_delta.c:204: error: (Each undeclared identifier is reported only once
combine_delta.c:204: error: for each function it appears in.)
make: *** [combine_delta.o] Error 1
@technion
Copy link

FYI, GCC 4.4.7 and Clang 3.4.2 on CentOS 6.5 don't suffer this issue.

technion added a commit to technion/Ntimed that referenced this issue Dec 30, 2014
…e/Infinity-and-NaN.html, a GNU extension.

Modern Linux's appear to support by default but older ones do not.
Fixes bsdphk#1.
@technion
Copy link

@joakimfors , I've created a patch in my repo, but I don't have an old enough Linux to test it with. Can you try it?

@joakimfors
Copy link
Author

make
cc -Wall -Werror   -c -o combine_delta.o combine_delta.c
combine_delta.c: In function ‘CD_AddSource’:
combine_delta.c:208: error: ‘INFINITY’ undeclared (first use in this function)
combine_delta.c:208: error: (Each undeclared identifier is reported only once
combine_delta.c:208: error: for each function it appears in.)
make: *** [combine_delta.o] Error 1

Perhaps the Makefile generation should be patched to include CFLAGS="-std=gnu99" instead?

@technion
Copy link

technion commented Jan 4, 2015

Now that's a worry. GNU decided that NAN was a GNU extension, but the link in my comment states clearly that INFINITY is part of the C99 standard and should exist everywhere.

Telling a portable program to compile with GNU extensions is not the right approach imo.

You don't by chance have default CFLAGS compiling for std89 or something do you?

Note that CentOS is from 2007.

@bsdphk
Copy link
Owner

bsdphk commented Jan 4, 2015

I have changed NAN which strictly speaking is only for float, to nan("") which is for double.

I'm not ever going to add a "-std=gnuanything" option if I can avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants