Author: rinrab
Date: Sat Jul 20 13:01:12 2024
New Revision: 1919396

URL: http://svn.apache.org/viewvc?rev=1919396&view=rev
Log:
On the 'cmake' branch: Support compiler hints for GNUC.

The specific for GNUC compile definition were copied from svn_private_config.h
generated by autoconf.

* subversion/svn_private_config.hc
  (compiler hints, comment): Remove `as supported by MS VC' from the comment
   since they are not MSVC only.
  (compiler hints, SVN__PREDICT_*): Add section with check for GNUC and
   setting up SVN__PREDICT_* macros.
  (compiler hints, SVN__*_INLINE): New section with GNUC specific macros.
  (SVN__PREDICT_*): Move definitions up, into ifdef.

Modified:
    subversion/branches/cmake/subversion/svn_private_config.hc

Modified: subversion/branches/cmake/subversion/svn_private_config.hc
URL: 
http://svn.apache.org/viewvc/subversion/branches/cmake/subversion/svn_private_config.hc?rev=1919396&r1=1919395&r2=1919396&view=diff
==============================================================================
--- subversion/branches/cmake/subversion/svn_private_config.hc (original)
+++ subversion/branches/cmake/subversion/svn_private_config.hc Sat Jul 20 
13:01:12 2024
@@ -85,21 +85,29 @@
 #define dgettext(domain, x) (x)
 #endif
 
-/* compiler hints as supported by MS VC */
+/* compiler hints */
+#if defined(__GNUC__) && (__GNUC__ >= 3)
+# define SVN__PREDICT_FALSE(x) (__builtin_expect(x, 0))
+# define SVN__PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
+#else
+# define SVN__PREDICT_FALSE(x) (x)
+# define SVN__PREDICT_TRUE(x) (x)
+#endif
+
 #if defined(SVN_DEBUG)
 # define SVN__FORCE_INLINE
 # define SVN__PREVENT_INLINE
 #elif defined(_MSC_VER)
 # define SVN__FORCE_INLINE __forceinline
 # define SVN__PREVENT_INLINE __declspec(noinline)
+#elif defined(__GNUC__) && (__GNUC__ >= 3)
+# define SVN__FORCE_INLINE APR_INLINE __attribute__ ((always_inline))
+# define SVN__PREVENT_INLINE __attribute__ ((noinline))
 #else
 # define SVN__FORCE_INLINE APR_INLINE
 # define SVN__PREVENT_INLINE
 #endif
 
-#define SVN__PREDICT_TRUE(x)  (x)
-#define SVN__PREDICT_FALSE(x)  (x)
-
 /* Macro used to specify that a variable is intentionally left unused.
    Suppresses compiler warnings about the variable being unused.  */
 #define SVN_UNUSED(v) ( (void)(v) )


Reply via email to