[OpenAFS] Syntax error in afs_md5.h on FreeBSD
Russ Allbery
rra@stanford.edu
Wed, 29 Aug 2007 10:28:25 -0700
Jim Rees <rees@umich.edu> writes:
> I would change the "static inline" to "inline." "static inline" doesn't
> make any sense to me in an include file, but I'm not familiar with that
> code.
Per http://www.greenend.org.uk/rjk/2003/03/inline.html
A function defined with "static inline". Stand-alone object code may
be emitted if required. You can have multiple definitions in your
program, in different translation units, and it will still work. Just
dropping the "inline" reduces the program to a portable one (again,
all other things being equal).
This is probably useful primarily for small functions that you might
otherwise use macros for. If the function isn't always inlined then
you get duplicate copies of the object code, with the problems
described above.
A sensible approach would be to put the "static inline" functions in
either a header file if they are to be widely used or just in the
source files that use them if they are only ever used from one file.
"static inline" used to be a GNU extension, I believe, but it appears that
C99 now defines it with the same semantics as GCC. I'm not sure why
you're getting a syntax error, but given the semantics of static inline, I
think the safe fix is to remove the "inline", not the "static". That will
give you the same semantics without the inlining, and should therefore
work the same, just a bit slower.
Of course, in this particular code, it may not matter -- I haven't looked
at it.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>