-
Notifications
You must be signed in to change notification settings - Fork 783
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
Make sure to use custom hypot() when building as ANSI C #547
Conversation
When compiling master with visual studio community 2015 - 64bit there are some warnings concerning this merge request :
The preprocessor has WIN32 defined but not ANSI. Looking at the visual studio Predefined Macros I can't see this ANSI macro. Perhaps it is only defined under gcc/mingw compiler ? I was thinking as using
inside Proj4Config.cmake as a cleaner way to make this check, but proj_config.h seems to not be used by project.h and an equivalent check should also be added to the autotools build.. So I'm not sure about how to resolve this issue :
Could you share some advices ? |
Nice catch. I was relying on the windows tests to catch this sort of thing. This changed worked for me, but not for the reason I expected, so let's get that fixed. I just made a few test with the following conditional:
How does that work for you? It seems to work for me building with nmake/visual studio and gcc with the -ansi flag. |
I've faced this issue with geodesic.[ch] which includes its own
and geodesic.c contains
(You might remember that one of the checkers dinged the copysignx By the way, in many places in the existing proj.4 code base, atanh |
Sure. Would you mind giving it a go? If not I'll revert the change in this PR so the bad code doesn't get in the next release. I am completely swamped the rest of the week and of on vacation for the next three weeks after that.
You should create an issue on it so we will remember to do something about it. |
I've created pull request #555. At present this just creates the HAVE_C99_MATH flag and so the proj.4 build isn't changed. However the next release of geodesic.c will test this flag. Also note the issue in the check in message: what to do if HAVE_C99_MATH is 0 (define the missing functions or assume that libm defines them). |
Just for the feedback the following conditional Thank's @cffk for creating a new pull request, I will look at your proposal. |
hypot()
is not defined in C versions earlier than C99. So when trying to build PROJ.4 as ANSI C warnings are issued.Below I build with
CFLAGS=-g -Wall -Wextra -Werror -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wformat -Werror=format-security -Wshadow -O2 -ansi
which results in a failed build becausehypot()
is unknown. This PR fixes the problem.