06 October 2009, 02:29 | #1 |
Zone Friend
|
xDMS vs. GNU99
Hi,
I'm planning to do a heavily-stripped-down version from xDMS to get some DMS support into ADFCHK, but I'm trying to compile with -std=gnu99. This already helped me to fix lots of dirty stuff which would normally get compiled as if it was the world's most perfect code. (orphaned extern declarations, and whatnot!!) Though now some ancient code in xDMS ( http://aminet.net/util/arc/xDMS.lha ) produces the following warning: Code:
xdms\u_deep.c: In function 'DecodeChar': xdms\u_deep.c:114: warning: 'update' is static but used in inline function 'DecodeChar' which is not static xdms\u_heavy.c: In function 'decode_c': xdms\u_heavy.c:80: warning: 'c_table' is static but used in inline function 'decode_c' which is not static xdms\u_heavy.c:82: warning: 'c_len' is static but used in inline function 'decode_c' which is not static xdms\u_heavy.c:92: warning: 'c_len' is static but used in inline function 'decode_c' which is not static xdms\u_heavy.c: In function 'decode_p': xdms\u_heavy.c:102: warning: 'pt_table' is static but used in inline function 'decode_p' which is not static xdms\u_heavy.c:103: warning: 'np' is static but used in inline function 'decode_p' which is not static xdms\u_heavy.c:104: warning: 'pt_len' is static but used in inline function 'decode_p' which is not static ... xdms\u_heavy.c:122: warning: 'lastlen' is static but used in inline function 'decode_p' which is not static xdms\u_heavy.c:125: warning: 'lastlen' is static but used in inline function 'decode_p' which is not static INLINE USHORT decode_c(void); INLINE USHORT decode_p(void); to static INLINE USHORT decode_c(void); static INLINE USHORT decode_p(void); gets rid of the warning...BUT... can I safely do this without getting ugly side-effects? To my knowledge, side-effects could only occur in this case if there was another implementation of decode_c()/decode_p() in some other file (since static also means that it's allowed to use the same function name in 2 different files, since the functions are only known locally to that one translation unit. Last edited by andreas; 09 October 2009 at 03:32. |
06 October 2009, 15:47 | #2 |
Registered User
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 213
|
Hi Andreas
I have also read your post on comp.lang.c As others told you in that thread, the meaning of "inline" is different between C99 and gnu99 I don't know the gnu99 extensions well (never used them) but in C99 it is a constraint violation if a inline function with external linkage does contain a reference to an identifier with internal linkage. it seems to me that that's exactly your case. I am not sure since "static" mean either no or internal linkage, depending on the scope. If the various "update", "c_table", etc are file scope identifiers, then that's your case. Anyway, I think that your problem is that those sources were made before C99 standirdized the inline keyword. So they depend on implementation defined behavior, i.e. the compiler used by the original developer. I agree with your knowledge regarding "static functions", i.e. functions with internal linkage. |
06 October 2009, 17:26 | #3 |
Zone Friend
|
Haha, hell yeah the Internet is just a village
But please note that the questions I asked on CLC and here are merely related; they are NOT identical. The one you read on the group was about inline/extern inline binding and no single thing about static. (deliberately, since it would a bit annoying others to mix two questions into one) That means, pretend as if you didn't read the usenet post so that you don't mix them by accident |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
xdms 1.3.2 | Qube | Coders. General | 43 | 08 May 2013 11:02 |
Help With xDMS | Aleph Five | support.Apps | 5 | 23 May 2010 12:43 |
Please avoid xDMS with files which contain headers | andreas | project.TOSEC (amiga only) | 5 | 31 March 2006 16:47 |
Who can program an xDMS clone with logging ability? | andreas | Coders. General | 10 | 08 October 2003 18:23 |
|
|