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

Add macro during lib discovery phase #633

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

facchinm
Copy link
Member

This information can be used by the core to turn off certain heavyweight headers (that don't need to be discovered anyway)

This information can be used by the core to turn off certain heavyweight headers (that don't need to be discovered anyway)
@facchinm facchinm requested a review from cmaglie March 24, 2020 10:02
@cmaglie cmaglie merged commit 985b2c9 into arduino:master Mar 24, 2020
@cmaglie cmaglie self-assigned this Mar 24, 2020
cmaglie added a commit to arduino/arduino-builder that referenced this pull request Jun 12, 2020
- Removed automatic '--relax' hack for compiles on Atmega2560 MCU
  arduino/arduino-cli#749

- Fixed skethbook+bootloader hex merger.
  arduino/arduino-cli#744

- Fixed race condition in legacy i18n.LoggerToCustomStreams
  arduino/arduino-cli#704

- Fixed path-relativization error when traversing different partitions
  arduino/arduino-cli#658

- Add macro during lib discovery phase
  arduino/arduino-cli#633

- legacy: Improved progress report from Compile
  arduino/arduino-cli#625
@fpistm
Copy link

fpistm commented Jul 16, 2020

This information can be used by the core to turn off certain heavyweight headers (that don't need to be discovered anyway)

Hi @facchinm

when you said it can be used, how ?

In fact we've met an issue since this has been added. It add an extra definition at the end of the command line but the compiler used doesn't understand it (https://github.com/stm32duino/Arduino_Core_STM8/issues/21):
unknown file type -DARDUINO_LIB_DISCOVERY_PHASE_258740\sketch\master_reader.pde.cpp:

as for the specific cosmic compiler used for the STM8 core "-D" is replaced by "-d"

Is it possible to avoid to add extra arguments?

Thanks in advance

@cmaglie
Copy link
Member

cmaglie commented Jul 17, 2020

hi @fpistm

I didn't know that the STM8 compiler use -D instead of -d, never heard of any other gcc-compatible compiler doing so, I guess it's kind of unique.

The definition -DARDUINO_LIB_DISCOVERY_PHASE has been added to allow exclusion of some header files during the library discovery, since during library discovery the compiler is launched many times this allows huge speedups if big headers are included from the sketch (that was the case for the mbed core for example).

BTW let's fix this, I'll open a new issue with a proposal.

@fpistm
Copy link

fpistm commented Jul 17, 2020

Hi @cmaglie
thanks for the quick feedback.
And right this is special 😕

cmaglie added a commit to cmaglie/arduino-cli that referenced this pull request Jul 17, 2020
cmaglie added a commit to cmaglie/arduino-cli that referenced this pull request Jul 17, 2020
Previously we used to add `-DARDUINO_LIB_DISCOVERY_PHASE` to the gcc
command line but this produced some incompatiblity with compilers using
non-standard `-d` flag instead of `-D`:

arduino#633 (comment)
cmaglie added a commit that referenced this pull request Jul 23, 2020
…me rare circumstances (#838)

* Revert "Add macro -DARDUINO_LIB_DISCOVERY_PHASE during lib discovery phase (#633)"

This reverts commit 985b2c9.

* Set {build.library_discovery_phase} to 1 during lib discovery

Previously we used to add `-DARDUINO_LIB_DISCOVERY_PHASE` to the gcc
command line but this produced some incompatiblity with compilers using
non-standard `-d` flag instead of `-D`:

#633 (comment)
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

Successfully merging this pull request may close these issues.

3 participants