summaryrefslogtreecommitdiff
path: root/perl.h
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 /perl.h
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 'perl.h')
-rw-r--r--perl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index 0d4a891ce2..7fcff2f6ba 100644
--- a/perl.h
+++ b/perl.h
@@ -140,6 +140,18 @@
# define EXTERN_C extern
#endif
+/* Fallback definitions in case we don't have definitions from config.h.
+ This should only matter for systems that don't use Configure and
+ haven't been modified to define PERL_STATIC_INLINE yet.
+*/
+#if !defined(PERL_STATIC_INLINE)
+# ifdef HAS_STATIC_INLINE
+# define PERL_STATIC_INLINE static inline
+# else
+# define PERL_STATIC_INLINE static
+# endif
+#endif
+
#ifdef PERL_GLOBAL_STRUCT
# ifndef PERL_GET_VARS
# ifdef PERL_GLOBAL_STRUCT_PRIVATE