[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inline functions with gnu99
From: |
John Darrington |
Subject: |
Re: inline functions with gnu99 |
Date: |
Mon, 24 Mar 2008 09:18:11 +0900 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Interesting. I never knew there was more than one interpretation.
To me, the inline keyword is a hint to the compiler that it might be
better to replace any calls to the function concerned with the body of
the function, rather than making a subroutine.
What else might it mean?
On Sun, Mar 23, 2008 at 02:35:38PM -0700, Ben Pfaff wrote:
John Darrington <address@hidden> writes:
> I've just upgraded gcc, and now I'm getting these annoying warnings:
>
> lib/gtksheet/gsheet-hetero-column.c:231: warning: C99 inline functions
> are not supported; using GNU89
> lib/gtksheet/gsheet-hetero-column.c:231: warning: to disable this
> warning use -fgnu89-inline or the gnu_inline function attribute
The function in question is defined as:
inline void
g_sheet_hetero_column_set_width (GSheetHeteroColumn *geo, glong i,
gint size)
and declared in the header file as:
void g_sheet_hetero_column_set_width (GSheetHeteroColumn *geo,
glong i, gint size);
The trouble is the "inline" keyword. GCC's customary
interpretation of "inline" clashes badly with the C99 definition
of "inline". In fact, the only place where they have the same
meaning is when a function is defined as "static inline". This
is why recent versions of GCC warn about other uses of inline:
the newest versions of GCC are switching from GCC's customary
interpretation to the C99 definition, and the GCC developers
don't want anyone to be caught off-guard by the changes.
In PSPP, we don't really need any inline functions other than
static inline functions. The inline keyword isn't really helping
here, since the inline definition is not in the header file
anyhow, so I would suggest just dropping the "inline" keyword
from the definition.
--
Ben Pfaff
http://benpfaff.org
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature