Skip to content

[BUG] Erroneous #elif with no condition in SPIFlashStorage.cpp (line 226). Should be #else. #19407

@StarNamer

Description

@StarNamer

Bug Description

Not exactly a bug, but certainly an error.

In SPIFlashStorage.cpp around line 226 is the sequence...

  #if HAS_SPI_FLASH_COMPRESSION
    // Restart the compressed buffer, keep the pointers of the uncompressed buffer
    m_compressedDataUsed = 0;
  #elif
    m_pageDataUsed = 0;
  #endif

The use of #elif without a condition instead of the correct #else means that a PlatformIO Inspect fails even though the code compiles.

Steps to Reproduce

In PlatformIO, run Inspect, it fails with "Errors: Bad JSON".

Run "pio check -v" (cppcheck) and it reports:
Marlin\src\lcd\extui\lib\mks_ui\SPIFlashStorage.cpp:226: [high:error] Syntax error in #elif [preprocessorErrorDirective]

Code should use #if...#else...#endif syntax unless there is a further condition to test.

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions