The -mmcu option for GCC sets macros like AVR_ATmega328P (with the trailing
underscores), be sure to include these underscores for Clangs -mcpu option.
See "AVR Built-in Macros" in https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html
Paths
| Differential D29817
[AVR] Fix __AVR_xxx macro definitions ClosedPublic Authored by Lekensteyn on Feb 10 2017, 2:26 AM.
Details Summary The -mmcu option for GCC sets macros like AVR_ATmega328P (with the trailing See "AVR Built-in Macros" in https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html
Diff Detail Event TimelineComment Actions Without this patch, compilation of a program using avr/io.h fails. Tested with: clang --target=avr -Xclang -target-cpu -Xclang atmega328p -I/usr/avr/include -Os led.c -c -o /dev/null Btw, it seems that avr-libc 2.0.0 also uses __AVR_ARCH__, __AVR_XMEGA__ and __AVR_3_BYTE_PC__ in some places, but these are not defined in Clang. Lekensteyn retitled this revision from [AVR} Fix __AVR_xxx macro definitions to [AVR] Fix __AVR_xxx macro definitions.Feb 10 2017, 2:36 AM Comment Actions Nice catch, unsure why I didn't catch this earlier. Do we also need to modify the other tests inside target-cpu-defines? Comment Actions Oops, missed the avrtiny patch. After updating that, it now actually passes the clang-test tests. This revision is now accepted and ready to land.Feb 10 2017, 8:33 AM Lekensteyn marked an inline comment as done. Comment ActionsGood catch! I just checked again and confirmed that there is only one line that had this issue (there are no other occurrences of ___"). Comment Actions
No I do not, please push it for me :-) Closed by commit rL294869: [AVR] Fix __AVR_xxx macro definitions; authored by Peter Wu (authored by dylanmckay). · Explain WhyFeb 11 2017, 1:17 PM This revision was automatically updated to reflect the committed changes. Comment Actions Done, thanks for the patch @Lekensteyn! If you plan on submitting more patches, feel free to ask for commit access.
Revision Contents
Diff 87973 lib/Basic/Targets.cpp
test/CodeGen/avr/target-cpu-defines/atmega328p.c
|
Four underscores?