Last active
May 15, 2024 21:15
-
-
Save hexeguitar/1ffa147b0c358cb3455879c2baa64c63 to your computer and use it in GitHub Desktop.
Trick to avoid sdcc (not supported keywords) errors in VScode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _VSCODE_SDCC_H | |
#define _VSCODE_SDCC_H | |
/* | |
There is currently no support for sdcc syntax (Intellisense) in VScode. | |
These defines will limit the number of reported errors due to undecognized | |
sdcc keywords like __code, __at etc. | |
The trick is, when editing the code in VScode, the SDCC is not defined, | |
it happens only at compile time. So we can use the "#ifndef SDCC" condition | |
to redefine the sdcc keywords as empty and make the errors go away. | |
When compiling, the SDCC is defined and the below redefinitions will not be | |
included. | |
Required only when working in VScode. | |
*/ | |
#ifndef SDCC | |
#define __code | |
#define __xdata | |
#define __data | |
#define __pdata | |
#define __at(x) | |
#define __sbit | |
#define __asm | |
#define __endasm | |
#define __interrupt | |
#define __using | |
#define bool uint8_t // with no SDCC defined, compiler.h will need bool | |
#endif | |
#endif // _VSCODE_SDCC_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just what I wanted! Thanks for sharing.