You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/10/17 04:49:50 UTC

svn commit: r1532954 - /subversion/trunk/subversion/include/svn_types.h

Author: breser
Date: Thu Oct 17 02:49:50 2013
New Revision: 1532954

URL: http://svn.apache.org/r1532954
Log:
Better detection of the warning attribute for SVN_EXPERIMENTAL.

First of all we should try to use the __has_attribute macro if available.
Which should allow clang to start using the warning attribute if/when
they add it.  

If not then we'll need to fall back on checking the compiler.  If the compiler
is the gcc driver for clang then it doesn't support __has_attribute and it
also won't set __clang__.  So we need to check for __llvm__ to properly
exclude this.  There's no way to gracefully start using the attribute
if the gcc driver gains support for this, but that's basically gcc's fault
for not having feature detection functionality.

* subversion/include/svn_types.h
  (SVN_EXPERIMENTAL): Use __has_attribute if available and __llvm__ to
    exclude the gcc driver for clang.

Modified:
    subversion/trunk/subversion/include/svn_types.h

Modified: subversion/trunk/subversion/include/svn_types.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1532954&r1=1532953&r2=1532954&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Thu Oct 17 02:49:50 2013
@@ -70,7 +70,13 @@ extern "C" {
  */
 #ifndef SVN_EXPERIMENTAL
 # if !defined(SWIGPERL) && !defined(SWIGPYTHON) && !defined(SWIGRUBY)
-#  if !defined(__clang__) && defined(__GNUC__) \
+#  if defined(__has_attribute)
+#    if __has_attribute(__warning__)
+#      define SVN_EXPERIMENTAL __attribute__((warning("experimental function used")))
+#    else
+#      define SVN_EXPERIMENTAL
+#    endif
+#  elif !defined(__llvm__) && defined(__GNUC__) \
       && (__GNUC__ >= 4 || (__GNUC__==3 && __GNUC_MINOR__>=1))
 #   define SVN_EXPERIMENTAL __attribute__((warning("experimental function used")))
 #  elif defined(_MSC_VER) && _MSC_VER >= 1300