"Function prototypes" and the C pre-processor…SOLVED

If this saves you a couple hours work, it has served its purpose!

The C pre-processor (maybe there are more than one) takes a pass over your source file and determines itself what function prototypes are needed. Then it inserts them in the stream for processing. Like #defines get expanded and inserted; maybe it’s the same preprocessor.

In my case, I never heard of this preprocessor function and it failed spectacularly as it tried to insert function prototypes. Dozens of errors appeared but by looking through the forum posts I started to understand. To “solve” the problem, I carefully put all my function prototypes in one place, right after the #include directive at the top of the file. I was working on a source file merge between myself and another guy also working on our “hobby project”. So our function prototypes were sprinkled rather willy nilly through the file. Shame on us.

Once the errors started, they compounded each other. One in particular was amusing as it said that the memory usage was 3,000,000,000 bytes and it was going to be a problem. Yeah, I guess it would.

One of the existing function prototypes we had placed in the file was:
void ISRmikeX ();
Note the space after the X. Fixing this alone caused the 3 billion byte error to change.

There’s a post that says that having a space in between the close paren and the semi-colon of a function prototype causes a problem. That’s what caused me to start looking carefully at my existing function prototypes.

Another oddity: When you get these long sets of errors, all you can do is slog through them to separate the warnings from the true errors. I noted that the compile/link process got far enough along at one point that it started working on other source files in the program. It gave me a warning/error – not sure which – that one pathway through a function did not return a value, which was the function’s job. But this was a function which had worked fine, at least during the compile process, for some time. No error message had every appeared in previous days’ compiles. But, yup, the error was really there in the original source file. (Stupid me.)

Seems like this was more severe than just a warning. It’s a hard error. But more to the point, why did the message show up only with all these error messages due to function prototypes?

A forum post says that a pragma tells the compile process not to do this pre-pass for function prototypes.


That does not seem to work. My compile messages simply said it was ignoring this pragma.

You can just ignore the warning, it does work non the less.

And it’s run before the C preprocessor kicks in. It turns an .ino file into .cpp and then passes it on.
Hence the C preproc/compiler ignores it, because the job’s already done.