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

Compiler warning/error: “_BSD_SOURCE and _SVID_SOURCE are deprecated” #334

Closed
Wuzzy2 opened this issue Nov 25, 2014 · 2 comments
Closed
Labels
Milestone

Comments

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Nov 25, 2014

When I try to compile d206041 under GNU/Linux, I get a compiler warning which is treated as error:

In file included from /usr/include/assert.h:35:0,
                 from /home/wuzzy/src/cdogs-sdl/git/src/cdogs/utils.h:52,
                 from /home/wuzzy/src/cdogs-sdl/git/src/cdogs/utils.c:50:
/usr/include/features.h:148:3: Fehler: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
[ 23%] cc1: Alle Warnungen werden als Fehler behandelt
src/tests/CMakeFiles/autosave_test.dir/build.make:192: recipe for target 'src/tests/CMakeFiles/autosave_test.dir/__/cdogs/utils.c.o' failed
make[2]: *** [src/tests/CMakeFiles/autosave_test.dir/__/cdogs/utils.c.o] Error 1
CMakeFiles/Makefile2:443: recipe for target 'src/tests/CMakeFiles/autosave_test.dir/all' failed
make[1]: *** [src/tests/CMakeFiles/autosave_test.dir/all] Error 2

(“Fehler:” is German for “Error:”. “Alle Warnungen werden als Fehler behandelt” is German for “All warnings are treated as errors”.)

I could fix this by changing line 49 of utils.c from #define _BSD_SOURCE to #define _DEFAULT_SOURCE.

@cxong
Copy link
Owner

cxong commented Nov 25, 2014

Looks like _DEFAULT_SOURCE was added in glibc 2.19 and _BSD_SOURCE deprecated in version 2.20. Both these versions are quite new so I think we'll need to test for the existence of _DEFAULT_SOURCE before using it.

@cxong
Copy link
Owner

cxong commented Nov 26, 2014

Correction: I think just adding a #define _DEFAULT_SOURCE in addition should work.

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

No branches or pull requests

2 participants