Hello,
compiling my source code, I encountered the following compiler error:
"no source": Error: #3734: __packed qualifier dropped when passing argument to unprototyped function
The MCU architecture is Cortex-M0.
The error is triggered when I change the compiler optimisation from o2 to o3. All the routines that the compiler labelled as unprototyped have the prototype in a separate header file.
I tried to find information about this error but without success. Could you help me in understanding the source of the issues and how to work on a workaround eventually?
Thanks in advance for all your support.
Regards, Alessandro
Hi,
the prototypes are always included and never disabled by specific #ifs.., aside from the main #ifdef - #define - #endif, of the header file.
After a lot, still no result, the error is still there when o3 is enabled.
Any ideas of what could be a possible workaround?
Cheers, Alessandro
Real hard to debug with no source code.
Make a minimally illustrative example, and post that. The compiler doesn't think you proto typed it, and I'm inclined to believe the compiler. Put a prototype immediately before use, review the context under which the packed directive was being used, and why that might be objectionable.
When there seems to be a disconnect between the code as you see it, and the code that the compiler is talking about - it may be time to look at the preprocessor output.
Note that the preprocessor output should be valid as input to the compiler - so you should still be able to compile it ...
It's highly unlikely you need a workaround. Probably just a simple omission on your source code that needs correcting.
aside from the main #ifdef - #define - #endif, of the header file.
Just on the off chance the above was not a typo: I hope you're aware that really should be
#ifndef INCLUDED_HEADER_NAME_XYZ #define INCLUDED_HEADER_NAME_XYZ #endif /* INCLUDED_HEADER_NAME_XYZ */
right? And that you have to make sure the INCLUDED_HEADER_NAME_XYZ name is used by exactly one header only, in the entire source code?