summaryrefslogtreecommitdiff
path: root/config_h.SH
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2010-07-22 11:14:47 -0400
committerAndy Dougherty <doughera@lafayette.edu>2010-07-22 11:14:47 -0400
commit17a6c8e38505fd8d5700febfe392e470c9c5fff8 (patch)
treed8b68a3b6d6ab3f8f2c3cd9249c1fbc8cdedd63f /config_h.SH
parent964a4988d8d817b838ce779c43bc86d4e738c878 (diff)
downloadperl-17a6c8e38505fd8d5700febfe392e470c9c5fff8.tar.gz
Add a Configure probe for static inline.
This patch enables Configure to probe for C99-style 'static inline'. (That is, functions may be inlined, but will not be externally visible.) The initial idea is that some common code in messy macros inside headers might be simplified using inline functions. If the compiler does not support 'static inline', then a plain 'static' is used instead, along with the consequent implications of a function call (though the compiler may optimize away the function call and inline the function anyway). In either case, you simply use PERL_STATIC_INLINE. This patch does not *use* this facility at all yet. It is merely a Configure patch to make the facility availble for others to experiment with. VMS and Windows files will still need to be manually updated. Finally, before actually converting anything to inline functions, please try to carefully evaluate the performance implications of any proposed changes. Compilers vary in what they will and will not convert to inline functions, so it's worth proceeding slowly and carefully. This patch results from a single new metaconfig unit, d_static_inline.U, which I will separately upload to the metaconfig repository.
Diffstat (limited to 'config_h.SH')
-rwxr-xr-xconfig_h.SH21
1 files changed, 21 insertions, 0 deletions
diff --git a/config_h.SH b/config_h.SH
index eedc7347ee..0e4c3a7c8d 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -3137,6 +3137,27 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
#define Siglongjmp(buf,retval) longjmp((buf),(retval))
#endif
+/* HAS_STATIC_INLINE:
+ * This symbol, if defined, indicates that the C compiler supports
+ * C99-style static inline. That is, the function can't be called
+ * from another translation unit.
+ */
+/* PERL_STATIC_INLINE:
+ * This symbol gives the best-guess incantation to use for static
+ * inline functions. If HAS_STATIC_INLINE is defined, this will
+ * give C99-style inline. If HAS_STATIC_INLINE is not defined,
+ * this will give a plain 'static'. It will always be defined
+ * to something that gives static linkage.
+ * Possibilities include
+ * static inline (c99)
+ * static __inline__ (gcc -ansi)
+ * static __inline (MSVC)
+ * static _inline (older MSVC)
+ * static (c89 compilers)
+ */
+#$d_static_inline HAS_STATIC_INLINE /**/
+#define PERL_STATIC_INLINE $perl_static_inline /**/
+
/* USE_STDIO_PTR:
* This symbol is defined if the _ptr and _cnt fields (or similar)
* of the stdio FILE structure can be used to access the stdio buffer