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 error with newer compiler #352

Closed
whoenig opened this issue Aug 2, 2018 · 0 comments
Closed

Compiler error with newer compiler #352

whoenig opened this issue Aug 2, 2018 · 0 comments
Milestone

Comments

@whoenig
Copy link
Contributor

whoenig commented Aug 2, 2018

Compiling the firmware with the following compiler version:

$arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q3-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Leads to a compiler error:

In file included from src/modules/src/crtp_commander_generic.c:35:0:
/usr/arm-none-eabi/include/math.h:133:12: error: expected identifier or '(' before 'double'
 extern int isnan (double);
            ^
src/utils/interface/num.h:41:28: error: expected ')' before '?' token
 #define isnan(n) ((n != n) ? 1 : 0)
                            ^
tools/make/targets.mk:26: recipe for target 'crtp_commander_generic.o' failed
make[1]: *** [crtp_commander_generic.o] Error 1
Makefile:330: recipe for target 'build' failed
make: *** [build] Error 2

The issue is that isnan is part of math.h (see https://en.cppreference.com/w/c/numeric/math/isnan), but it is redefined in num.h.

whoenig added a commit to USC-ACTLab/crazyflie-firmware that referenced this issue Aug 2, 2018
This change removes the max,min and isnan macros
in num.h. The min, max macros are replaced by
fminf and fmaxf, avoiding side-effects that can
be caused by macros.

isnan is replaced by the compiler-provided
macro (part of math.h).

This fixes issue bitcraze#352.
@krichardsson krichardsson added this to the next-version milestone Aug 6, 2018
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

2 participants