guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inline machinery


From: Ludovic Courtès
Subject: Inline machinery
Date: Fri, 22 Feb 2008 09:51:22 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi,

The `inline.h' machinery is confusing for some compilers (e.g.,
DEC/Compaq/HP CC).  The issue is the following: when an inline keyword
is supported and a non-GCC compiler is used, the header looks like this:

  extern SCM scm_cell (...);

  static inline
  scm_cell (...)
  { ... }

The `extern' followed by `static' causes a "mixed linkage" error.  With
the DEC/Compaq/HP compiler, it looks like this:

  cc: Warning: ../libguile/inline.h, line 68: In this declaration, "scm_cell" 
is declared with both internal and external linkage.  The previous declaration 
is at line number 41 in file ../libguile/inline.h. (mixlinkage)
  scm_cell (scm_t_bits car, scm_t_bits cdr)
  ^

However, with GCC, "extern inline" and `-Wmissing-prototype' are used,
which means we still need the `extern' declarations.

Thus I will apply the following patch if nobody objects.

Thanks,
Ludovic.

Index: libguile/inline.h
===================================================================
RCS file: /sources/guile/guile/guile-core/libguile/inline.h,v
retrieving revision 1.30.2.2
diff -u -r1.30.2.2 inline.h
--- libguile/inline.h   19 May 2006 23:49:55 -0000      1.30.2.2
+++ libguile/inline.h   22 Feb 2008 08:43:42 -0000
@@ -3,7 +3,7 @@
 #ifndef SCM_INLINE_H
 #define SCM_INLINE_H
 
-/* Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, 
Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,6 +38,12 @@
 #include "libguile/pairs.h"
 
 
+#if ((!defined SCM_C_INLINE) && (!defined SCM_INLINE_C_INCLUDING_INLINE_H)) \
+     || (defined __GNUC__)
+
+/* The `extern' declarations.  They should only appear when `inline' is not
+   supported at all or when GCC's "extern inline" is used.  */
+
 SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
 SCM_API SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr,
                             scm_t_bits ccr, scm_t_bits cdr);
@@ -45,6 +51,10 @@
 SCM_API SCM scm_array_handle_ref (scm_t_array_handle *h, ssize_t pos);
 SCM_API void scm_array_handle_set (scm_t_array_handle *h, ssize_t pos, SCM 
val);
 
+SCM_API int scm_is_pair (SCM x);
+
+#endif
+
 
 #if defined SCM_C_INLINE || defined SCM_INLINE_C_INCLUDING_INLINE_H
 /* either inlining, or being included from inline.c.  We use (and
Index: libguile/pairs.h
===================================================================
RCS file: /sources/guile/guile/guile-core/libguile/pairs.h,v
retrieving revision 1.38.2.1
diff -u -r1.38.2.1 pairs.h
--- libguile/pairs.h    12 Feb 2006 13:42:51 -0000      1.38.2.1
+++ libguile/pairs.h    22 Feb 2008 08:43:42 -0000
@@ -3,7 +3,7 @@
 #ifndef SCM_PAIRS_H
 #define SCM_PAIRS_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2004, 2006, 2008 Free Software 
Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -78,8 +78,6 @@
 SCM_API void scm_error_pair_access (SCM);
 #endif
 
-SCM_API int scm_is_pair (SCM x);
-
 SCM_API SCM scm_cons (SCM x, SCM y);
 SCM_API SCM scm_cons2 (SCM w, SCM x, SCM y);
 SCM_API SCM scm_pair_p (SCM x);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]