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

ignore warning sign-compare in pin_is_protected #27261

Merged

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented Jul 12, 2024

Description

Since #27219 most 32bit boards give a compiler warning

Marlin/src/MarlinCore.cpp:320:13: warning: comparison of integer expressions of different signedness: 'const pin_t' {aka 'const long int'} and 'uint32_t' {aka 'long unsigned int'} [-Wsign-compare]
  320 |     if (pin == analogInputToDigitalPin(pgm_read_pin(&sensitive_dio[i]))) return true;

Since this function is already using #pragma GCC diagnostic ignored "-Wnarrowing"
I added #pragma GCC diagnostic ignored "-Wsign-compare"
To just silence the warning.

Requirements

Any 32 bit controller

Benefits

warning removed.

Related Issues

  • [BUG] Compiler Warning on MarlinCore.cpp #27258
  • @thinkyhead thinkyhead merged commit ce796ce into MarlinFirmware:bugfix-2.1.x Jul 14, 2024
    62 checks passed
    @thisiskeithb
    Copy link
    Member

    thisiskeithb commented Jul 14, 2024

    @thinkyhead: The additional commits you added to this PR breaks compiling for the Simulator (at least on macOS & Linux):

    Compiling .pio/build/simulator_macos_debug/debug/src/src/HAL/shared/eeprom_api.o
    Compiling .pio/build/simulator_macos_debug/debug/src/src/HAL/shared/esp_wifi.o
    Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp: In function 'int8_t get_pin_mode(pin_t)':
    Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp:30:47: error: 'isValidPin' was not declared in this scope
       30 | int8_t get_pin_mode(const pin_t pin) { return isValidPin(pin) ? 0 : -1; }
          |                                               ^~~~~~~~~~
    In file included from Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp:26:
    Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp: In function 'bool getPinIsDigitalByIndex(pin_t)':
    Marlin/src/HAL/NATIVE_SIM/pinsDebug.h:33:25: error: 'digitalPinToAnalogIndex' was not declared in this scope
       33 | #define isAnalogPin(P) (digitalPinToAnalogIndex(P) >= 0 ? 1 : 0)
          |                         ^~~~~~~~~~~~~~~~~~~~~~~
    Marlin/src/HAL/NATIVE_SIM/pinsDebug.cpp:41:11: note: in expansion of macro 'isAnalogPin'
       41 |   return !isAnalogPin(pin) || get_pin_mode(pin) != ADC_pin_mode(pin);
          |           ^~~~~~~~~~~
    *** [.pio/build/simulator_macos_debug/debug/src/src/HAL/NATIVE_SIM/pinsDebug.o] Error 1

    @ellensp
    Copy link
    Contributor Author

    ellensp commented Jul 14, 2024

    update the sim with latest function names p3p/MarlinSimUI#47

    This was referenced Jul 15, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants