We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I use Keil MicroVision (v. 5.11.1.0) for programming a Cortex-M4 microcontroller from TI.
After migrating my project from StellarisWare to TivaWare I get compiler errors for nearly equal line of code, which contains a line break.
For me it doesn't seem TI specific, so I post it here in the Keil forum.
Here is an example error:
compiling ustdlib.c... ..\..\TivaWareM4C\utils/ustdlib.h(55): error: #18: expected a ")" extern int usnprintf(char * restrict s, size_t n, const char * restrict format,
The related source lines are these:
extern int usnprintf(char * restrict s, size_t n, const char * restrict format, ...);
I'm not shure, why TI added a line break and what's the meaning of "...". I don't want to modify this file (and others) of the TivaWare package, because this can cause a coders hell.
.
What's strange?
StellarisWare (the predecessor of TivaWare) also contains a file "ustdlib.c", which also has definitions with line breaks. But compiling this causes no error.
In direct comparison:
Line in "ustdlib.c" of StellarisWare:
extern int usnprintf(char *pcBuf, unsigned long ulSize, const char *pcString, ...);
Line in "ustdlib.c" of TivaWare:
The same compiler error happens to other lines, which contains a line break. Example:
extern float ustrtof(const char * restrict nptr, const char ** restrict endptr);
Why I get such compiler errors after my migration to TivaWare? Also before the migration I included the file "ustdlib.c" (including such wrapped lines) and had no errors.
If you need further information, just tell me.
If the compiler doesn't understand the "restrict" keyword, then I would see it generate interesting error messages when it thinks it sees _two_ parameter names after each other instead of seeing a ',' or a ')'.
The keyword "restrict" was added in C99 to help with optimization by telling the compiler that there is no pointer aliasing it need to worry about.
The meaning of ... is that the function can take zero or more extra parameters. It's a variadic function.