After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 157536 - pango doesn't compile on Sparc/Solaris using Forte (cc)
pango doesn't compile on Sparc/Solaris using Forte (cc)
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Solaris
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 136425 162599 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-11-06 18:57 UTC by Jens Hatlak
Modified: 2011-02-18 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proof-of-concept patch (1.83 KB, patch)
2004-12-31 18:22 UTC, The Written Word
needs-work Details | Review
Updated patch with g_can_inline=$g_can_inline (1.99 KB, patch)
2005-01-03 17:01 UTC, The Written Word
none Details | Review

Description Jens Hatlak 2004-11-06 18:57:17 UTC
Try to compile with Forte (cc) - it will fail with something like
(undefined symbol) g_string_insert_c in ottest.o

Fix (patch, actually): See
http://mail.gnome.org/archives/gtk-i18n-list/2004-June/msg00020.html
I can confirm this does the trick, even for 1.6.0 which I tried to compile.
Patching the Makefile isn't nice, so a real fix would be great.

I'm just wondering why no-one noticed this one since the posting appeared on a
gnome mailing list...
Comment 1 Owen Taylor 2004-11-06 21:11:00 UTC
I'm simply not going to hack Pango because Glib's configure tests
didn't work properly on a system. If including glib.h is causing
code to be generated in your object files, that's a serious problem.
Comment 2 Matthias Clasen 2004-11-16 06:13:04 UTC
This could be related to bug 149907
Comment 3 Owen Taylor 2004-12-31 14:32:20 UTC
*** Bug 162599 has been marked as a duplicate of this bug. ***
Comment 4 The Written Word 2004-12-31 15:20:56 UTC
Consider the following code:

int func2 (int);

static inline int
func1 (void) {
  return func2 (1);
}

int
main (void) {
  int i = 1;
}

The following compilers *will not* create an undefined entry in the inline.o
object file:
  SGI MIPSPro 7.4.2m
  Tru64 UNIX DTK V6.5-207
  IBM VisualAge Compiler v6, v7

The following compilers *will* create an undefined entry:
  Sun Forte Developer 6 Compiler (C 5.3)
  Sun One Studio 8 Compiler (C 5.5)
  HP-UX 10.20 C Compiler (B.10.20.09)
  HP-UX 11.x C compiler (B.11.11.08)

This looks like a compiler bug to me. Old compilers like the ones for HP-UX
10.20 will never get fix (but it doesn't run ottest anyway as varargs aren't
available). I'll report the bug to Sun. Dunno if they'll fix in the older
compilers though.
Comment 5 Owen Taylor 2004-12-31 17:06:46 UTC
I think we need to fix the tests in configure.in so that G_CAN_INLINE
doesn't end up set if an unused inline function defintion results in
generated code. 

What G_CAN_INLINE is supposed to indicate really isn't whether local
inline functions work or not ... the definition of inline to empty
in gutils.h takes care of that. What it is supposed to indicate is
whether we can put inline functions in header files.

Using something like your test above with a AC_LINK_IFELSE should work.

(It could, of coursem depend on optimization level but getting it right
with autoconf's default optimization level is a start.)
Comment 6 The Written Word 2004-12-31 17:26:17 UTC
How about we ditch the G_CAN_INLINE machinery in glib/gutils.h and do it all at
configure-time? We'd have a G_CAN_INLINE in glibconfig.h. I'd essentially leave
all of the existing INLINE machinery in configure.in in place and add
G_CAN_INLINE to the mix.
Comment 7 The Written Word 2004-12-31 18:22:00 UTC
Created attachment 35326 [details] [review]
Proof-of-concept patch

I haven't tested this yet but how's it look as a proof-of-concept?
Comment 8 Owen Taylor 2004-12-31 18:29:59 UTC
Patch looks good to me from visual inspection.
Comment 9 The Written Word 2005-01-01 20:15:52 UTC
Ok, I've tested this patch on Solaris 2.6-9/SPARC and HP-UX 10.20, 11.x. It
works fine.
Comment 10 Matthias Clasen 2005-01-03 16:36:34 UTC
The patch misses a 

g_can_inline=$g_can_inline

next to 

g_have_gnuc_visibility=$g_have_gnuc_visibility

And I wonder whether gutils.h shouldn't be further simplified. There are still
instances of #undef G_CAN_INLINE, and there is also the question why we define
G_INLINE_FUNC as extern if inlining doesn't work (bug 149907)
Comment 11 Matthias Clasen 2005-01-03 16:39:54 UTC
Another question is about the use of G_CAN_INLINE in gstring.h: It looks
slightly dubious to me that the ABI depends on G_CAN_INLINE there. Shouldn't we
do the same
thing we do for gutils.h there ?
Comment 12 The Written Word 2005-01-03 17:01:41 UTC
Created attachment 35392 [details] [review]
Updated patch with g_can_inline=$g_can_inline
Comment 13 Owen Taylor 2005-01-03 21:49:29 UTC
OK, went through the patch in some more detail:

 - With the revised patch, the gutils.h machinery looks fine.
   I don't think it's further simplifiable; morten is likely right
   that G_INLINE_FUNC should be empty for G_IMPLEMENT_INLINES.
   There's also another issue that C99 defines 'extern inline' 
   in a way that is incompatible with the old GCC definition of
   it, so the 'if defined (__GNUC__) && defined (__OPTIMIZE__)'
   switch that picks 'extern inline' probably should be removed.
   But both of those are unrelated to this change.

 - The patch unconditionally defines G_CAN_INLINE for __cplusplus ...
   does the C++ spec guarantee that a 'static inline' function 
   won't have code emitted if the definition is never used?

 - Might be good to use something more distinct that func2() in 
   the test. Maybe glib_test_func2() or something. 

 - Before committing, we should definitely check that G_CAN_INLINE
   is getting defined and stuff is getting inlined with GCC.
Comment 14 Matthias Clasen 2005-01-03 21:53:50 UTC
I checked that G_CAN_INLINE gets defined.

What is your take on the gstring.h use of G_CAN_INLINE ?
Comment 15 Matthias Clasen 2005-01-04 05:32:00 UTC
2005-01-04  Matthias Clasen  <mclasen@redhat.com>

	Fix the inlining magic.  (#157536, Jens Hatlak, and
	#149907, Morten Welinder)
	
	* configure.in: Define G_CAN_INLINE in glibconfig.h

	* glib/gutils.h: Streamline the inlining magic a bit,
	don't use extern when implementing the non-inlined 
	version.
Comment 16 Owen Taylor 2005-01-04 17:00:26 UTC
*** Bug 136425 has been marked as a duplicate of this bug. ***