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

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

Closed
StarNamer opened this issue Sep 15, 2020 · 2 comments

Comments

@StarNamer
Copy link

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

rhapsodyv added a commit to rhapsodyv/Marlin that referenced this issue Sep 15, 2020
It wasn't breaking because the else was never taken, but its a typo and it was reported in MarlinFirmware#19407.
@ellensp
Copy link
Contributor

ellensp commented Sep 17, 2020

Now merged. Closing.

@ellensp ellensp closed this as completed Sep 17, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants