bogde / HX711

An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales.
MIT License
876 stars 535 forks source link

warning: this use of "defined" may not be portable [-Wexpansion-to-defined] #248

Open hafenhuhn1 opened 1 year ago

hafenhuhn1 commented 1 year ago

When building with warnings enabled:

C:\path\to\HX711_Arduino_Library\src\HX711.cpp:31:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if HAS_ATOMIC_BLOCK
     ^~~~~~~~~~~~~~~~
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:31:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:36:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if FAST_CPU
     ^~~~~~~~
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:36:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:36:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:36:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:36:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:36:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:130:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
  #if HAS_ATOMIC_BLOCK
      ^~~~~~~~~~~~~~~~
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:130:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:133:8: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
  #elif IS_FREE_RTOS
        ^~~~~~~~~~~~
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:155:7: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
   #if ARCH_ESPRESSIF
       ^~~~~~~~~~~~~~
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:155:7: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:159:7: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
   #if ARCH_ESPRESSIF
       ^~~~~~~~~~~~~~
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:159:7: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
C:\path\to\HX711_Arduino_Library\src\HX711.cpp:164:6: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
  #if IS_FREE_RTOS
      ^~~~~~~~~~~~

I think it's complaining that your are trying to use the value of a #define in an #if, which may not be portable. See https://stackoverflow.com/questions/42074035/how-to-deal-with-clangs-3-9-wexpansion-to-defined-warning