subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1543394 - in /subversion/trunk/subversion: include/svn_dirent_uri.h include/svn_path.h include/svn_types.h include/svn_xml.h libsvn_ra_serf/ra_serf.h
Date Tue, 19 Nov 2013 11:37:36 GMT
Author: julianfoad
Date: Tue Nov 19 11:37:36 2013
New Revision: 1543394

URL: http://svn.apache.org/r1543394
Log:
Following r1543145 (fixing a 'strange error' caused by a missing sentinel
argument), tag the functions that require a sentinel null as their last
argument such that GCC will warn if the sentinel is missing.

This attribute, however, only works (with GCC and Clang) where the sentinel
argument is of a pointer type, so it doesn't help in the specific case of
r1543145 because SVN_NO_ERROR is currently declared as a plain '0', but it
does help in these few other cases.

I enabled this for GCC >= 4.0, according to anecdotal evidence, and for
Clang when Clang claims it is available. I don't see an equivalent attribute
for MSC or other compilers but if there is one we can add it later.

* subversion/include/svn_types.h
  (SVN_NEEDS_SENTINEL_NULL): Define.

* subversion/include/svn_dirent_uri.h
  (svn_dirent_join_many): Tag.

* subversion/include/svn_path.h
  (svn_path_join_many): Tag.

* subversion/include/svn_xml.h
  (svn_xml_make_open_tag): Tag.

* subversion/libsvn_ra_serf/ra_serf.h
  (svn_ra_serf__add_open_tag_buckets): Tag.

Modified:
    subversion/trunk/subversion/include/svn_dirent_uri.h
    subversion/trunk/subversion/include/svn_path.h
    subversion/trunk/subversion/include/svn_types.h
    subversion/trunk/subversion/include/svn_xml.h
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h

Modified: subversion/trunk/subversion/include/svn_dirent_uri.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_dirent_uri.h?rev=1543394&r1=1543393&r2=1543394&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_dirent_uri.h (original)
+++ subversion/trunk/subversion/include/svn_dirent_uri.h Tue Nov 19 11:37:36 2013
@@ -218,7 +218,7 @@ svn_dirent_join(const char *base,
 char *
 svn_dirent_join_many(apr_pool_t *result_pool,
                      const char *base,
-                     ...);
+                     ...) SVN_NEEDS_SENTINEL_NULL;
 
 /** Join a base relpath (@a base) with a component (@a component).
  * @a component need not be a single component.

Modified: subversion/trunk/subversion/include/svn_path.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_path.h?rev=1543394&r1=1543393&r2=1543394&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_path.h (original)
+++ subversion/trunk/subversion/include/svn_path.h Tue Nov 19 11:37:36 2013
@@ -131,7 +131,9 @@ svn_path_join(const char *base, const ch
  */
 SVN_DEPRECATED
 char *
-svn_path_join_many(apr_pool_t *pool, const char *base, ...);
+svn_path_join_many(apr_pool_t *pool,
+                   const char *base,
+                   ...) SVN_NEEDS_SENTINEL_NULL;
 
 
 /** Get the basename of the specified canonicalized @a path.  The

Modified: subversion/trunk/subversion/include/svn_types.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1543394&r1=1543393&r2=1543394&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_types.h (original)
+++ subversion/trunk/subversion/include/svn_types.h Tue Nov 19 11:37:36 2013
@@ -89,6 +89,24 @@ extern "C" {
 # endif
 #endif
 
+/** Macro used to mark functions that require a final null sentinel argument.
+ *
+ * @since New in 1.9.
+ */
+#ifndef SVN_NEEDS_SENTINEL_NULL
+#  if defined(__has_attribute)
+#    if __has_attribute(__sentinel__)
+#      define SVN_NEEDS_SENTINEL_NULL __attribute__((sentinel))
+#    else
+#      define SVN_NEEDS_SENTINEL_NULL
+#    endif
+#  elif defined(__GNUC__) && (__GNUC__ >= 4)
+#    define SVN_NEEDS_SENTINEL_NULL __attribute__((sentinel))
+#  else
+#    define SVN_NEEDS_SENTINEL_NULL
+#  endif
+#endif
+
 
 /** Indicate whether the current platform supports unaligned data access.
  *

Modified: subversion/trunk/subversion/include/svn_xml.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_xml.h?rev=1543394&r1=1543393&r2=1543394&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_xml.h (original)
+++ subversion/trunk/subversion/include/svn_xml.h Tue Nov 19 11:37:36 2013
@@ -323,7 +323,7 @@ svn_xml_make_open_tag(svn_stringbuf_t **
                       apr_pool_t *pool,
                       enum svn_xml_open_tag_style style,
                       const char *tagname,
-                      ...);
+                      ...) SVN_NEEDS_SENTINEL_NULL;
 
 
 /** Like svn_xml_make_open_tag(), but takes a @c va_list instead of being

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1543394&r1=1543393&r2=1543394&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Tue Nov 19 11:37:36 2013
@@ -1055,7 +1055,7 @@ void
 svn_ra_serf__add_open_tag_buckets(serf_bucket_t *agg_bucket,
                                   serf_bucket_alloc_t *bkt_alloc,
                                   const char *tag,
-                                  ...);
+                                  ...) SVN_NEEDS_SENTINEL_NULL;
 
 /*
  * Add the appropriate serf buckets to AGG_BUCKET representing xml tag close



Mime
View raw message