A
Andreas Eibach
Hi,
me again.
This "project" (lol) compiles without any warnings if -std=gnu99 is NOT
specified.
However, once it is specified, the inline function is treated as if not
there.
line:
gcc -o a.exe -O2 -Wall -std=gnu99 misc.c menu.c main.c
As I learned it long ago, the order of the translation units DOES matter.
Thus, if I have
[misc.c] inline void shortfunc(USHORT x) { ... }
I may use
[menu.c] extern inline void shortfunc(USHORT);
However, this causes major trouble with gnu99 standard.
Here's my code: (sorry 6 files)
--------
[misc.c]
--------
#include "misc.h"
inline void strToUpper (char* s)
{
while (*s)
{
if(*s > 96 && *s<123)
*s-=32;
s++;
}
}
--------
[misc.h]
--------
ULONG somevariable;
--------
[main.c]
--------
#include "main.h"
int main(int argc, char* argv[])
{ return 0; }
--------
[main.h]
--------
/* here's the troublesome extern inline reference, PREVIOUSLY defined in
misc.c */
extern inline void strToUpper (char*);
--------
[menu.c]
--------
#include "menu.h"
void dummy (void)
{ }
--------
[menu.h]
--------
/* adfmenu.h */
extern inline void strToUpper (char*);
-----
OK, that's it so far...
And now I get: (line numbers removed because they may vary)
menu.h: warning: inline function 'strToUpper' declared but never defined
menu.h: warning: inline function 'strToUpper' declared but never defined
main.h: warning: inline function 'strToUpper' declared but never defined
main.h: warning: inline function 'strToUpper' declared but never defined
"Never defined"? Well, there IS some code in strToUpper(), so this warning
is keeping me puzzled...
Thanks for any insights.
-Andreas
me again.
This "project" (lol) compiles without any warnings if -std=gnu99 is NOT
specified.
However, once it is specified, the inline function is treated as if not
there.
line:
gcc -o a.exe -O2 -Wall -std=gnu99 misc.c menu.c main.c
As I learned it long ago, the order of the translation units DOES matter.
Thus, if I have
[misc.c] inline void shortfunc(USHORT x) { ... }
I may use
[menu.c] extern inline void shortfunc(USHORT);
However, this causes major trouble with gnu99 standard.
Here's my code: (sorry 6 files)
--------
[misc.c]
--------
#include "misc.h"
inline void strToUpper (char* s)
{
while (*s)
{
if(*s > 96 && *s<123)
*s-=32;
s++;
}
}
--------
[misc.h]
--------
ULONG somevariable;
--------
[main.c]
--------
#include "main.h"
int main(int argc, char* argv[])
{ return 0; }
--------
[main.h]
--------
/* here's the troublesome extern inline reference, PREVIOUSLY defined in
misc.c */
extern inline void strToUpper (char*);
--------
[menu.c]
--------
#include "menu.h"
void dummy (void)
{ }
--------
[menu.h]
--------
/* adfmenu.h */
extern inline void strToUpper (char*);
-----
OK, that's it so far...
And now I get: (line numbers removed because they may vary)
menu.h: warning: inline function 'strToUpper' declared but never defined
menu.h: warning: inline function 'strToUpper' declared but never defined
main.h: warning: inline function 'strToUpper' declared but never defined
main.h: warning: inline function 'strToUpper' declared but never defined
"Never defined"? Well, there IS some code in strToUpper(), so this warning
is keeping me puzzled...
Thanks for any insights.
-Andreas