summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2012-01-09 14:06:18 +0100
committerStefan Fritsch <sf@apache.org>2012-01-09 14:06:18 +0100
commit75dad9d44fced370f7fe1cc63522654594ed0cc0 (patch)
tree42ce2fb14d918f301c930ca903da6dc202bd8754 /include
parentAdd <glossary> to nroff.xsl and revert r1222335 partially. (diff)
downloadapache2-75dad9d44fced370f7fe1cc63522654594ed0cc0.tar.xz
apache2-75dad9d44fced370f7fe1cc63522654594ed0cc0.zip
Rename ap_func_attr_* macros to AP_FN_ATTR_*
Add macro for attribute alloc_size on newer gcc's git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1229134 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/ap_config.h18
-rw-r--r--include/http_protocol.h2
-rw-r--r--include/http_request.h2
-rw-r--r--include/httpd.h11
-rw-r--r--include/util_cookies.h8
-rw-r--r--include/util_filter.h2
-rw-r--r--include/util_script.h4
7 files changed, 31 insertions, 16 deletions
diff --git a/include/ap_config.h b/include/ap_config.h
index 4f0500368e..a560817a34 100644
--- a/include/ap_config.h
+++ b/include/ap_config.h
@@ -223,17 +223,27 @@
#define __has_attribute(x) 0
#endif
#if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
-#define ap_func_attr_sentinel __attribute__((sentinel))
+#define AP_FN_ATTR_SENTINEL __attribute__((sentinel))
#else
-#define ap_func_attr_sentinel
+#define AP_FN_ATTR_SENTINEL
#endif
#if ( defined(__GNUC__) && \
(__GNUC__ >= 4 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))) \
|| __has_attribute(warn_unused_result)
-#define ap_func_attr_warn_unused_result __attribute__((warn_unused_result))
+#define AP_FN_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
-#define ap_func_attr_warn_unused_result
+#define AP_FN_ATTR_WARN_UNUSED_RESULT
+#endif
+
+#if ( defined(__GNUC__) && \
+ (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)) \
+ || __has_attribute(alloc_size)
+#define AP_FN_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
+#define AP_FN_ATTR_ALLOC_SIZE2(x,y) __attribute__((alloc_size(x,y)))
+#else
+#define AP_FN_ATTR_ALLOC_SIZE(x)
+#define AP_FN_ATTR_ALLOC_SIZE2(x,y)
#endif
#endif /* AP_CONFIG_H */
diff --git a/include/http_protocol.h b/include/http_protocol.h
index 377b8f1248..d0d1f27ae2 100644
--- a/include/http_protocol.h
+++ b/include/http_protocol.h
@@ -355,7 +355,7 @@ static APR_INLINE int ap_rputs(const char *str, request_rec *r)
* @return The number of bytes sent
*/
AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Output data to the client in a printf format
diff --git a/include/http_request.h b/include/http_request.h
index e2e4e6ebf2..a81e7538b2 100644
--- a/include/http_request.h
+++ b/include/http_request.h
@@ -285,7 +285,7 @@ AP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime);
* @return None.
*/
AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Add one or more methods to the list permitted to access the resource.
diff --git a/include/httpd.h b/include/httpd.h
index 2f41cc6bcc..c6eb15e9bf 100644
--- a/include/httpd.h
+++ b/include/httpd.h
@@ -2137,7 +2137,9 @@ AP_DECLARE(void) ap_abort_on_oom(void) __attribute__((noreturn));
* @return pointer to the allocated memory
* @note ap_malloc may be implemented as a macro
*/
-AP_DECLARE(void *) ap_malloc(size_t size) __attribute__((malloc));
+AP_DECLARE(void *) ap_malloc(size_t size)
+ __attribute__((malloc))
+ AP_FN_ATTR_ALLOC_SIZE(1);
/**
* Wrapper for calloc() that calls ap_abort_on_oom() if out of memory
@@ -2146,7 +2148,9 @@ AP_DECLARE(void *) ap_malloc(size_t size) __attribute__((malloc));
* @return pointer to the allocated memory
* @note ap_calloc may be implemented as a macro
*/
-AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size) __attribute__((malloc));
+AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size)
+ __attribute__((malloc))
+ AP_FN_ATTR_ALLOC_SIZE2(1,2);
/**
* Wrapper for realloc() that calls ap_abort_on_oom() if out of memory
@@ -2156,7 +2160,8 @@ AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size) __attribute__((malloc));
* @note ap_realloc may be implemented as a macro
*/
AP_DECLARE(void *) ap_realloc(void *ptr, size_t size)
- ap_func_attr_warn_unused_result;
+ AP_FN_ATTR_WARN_UNUSED_RESULT
+ AP_FN_ATTR_ALLOC_SIZE2(1,2);
#define AP_NORESTART APR_OS_START_USEERR + 1
diff --git a/include/util_cookies.h b/include/util_cookies.h
index c424dc045d..51f8facbc7 100644
--- a/include/util_cookies.h
+++ b/include/util_cookies.h
@@ -68,7 +68,7 @@ typedef struct {
AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name,
const char *val, const char *attrs,
long maxage, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Write an RFC2965 compliant cookie.
@@ -85,7 +85,7 @@ AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name,
AP_DECLARE(apr_status_t) ap_cookie_write2(request_rec * r, const char *name2,
const char *val, const char *attrs2,
long maxage, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Remove an RFC2109 compliant cookie.
@@ -99,7 +99,7 @@ AP_DECLARE(apr_status_t) ap_cookie_write2(request_rec * r, const char *name2,
*/
AP_DECLARE(apr_status_t) ap_cookie_remove(request_rec * r, const char *name,
const char *attrs, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Remove an RFC2965 compliant cookie.
@@ -113,7 +113,7 @@ AP_DECLARE(apr_status_t) ap_cookie_remove(request_rec * r, const char *name,
*/
AP_DECLARE(apr_status_t) ap_cookie_remove2(request_rec * r, const char *name2,
const char *attrs2, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Read a cookie called name, placing its value in val.
diff --git a/include/util_filter.h b/include/util_filter.h
index cc2a0f76e3..ebe8de4637 100644
--- a/include/util_filter.h
+++ b/include/util_filter.h
@@ -568,7 +568,7 @@ AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb);
AP_DECLARE_NONSTD(apr_status_t) ap_fputstrs(ap_filter_t *f,
apr_bucket_brigade *bb,
...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Output data to the filter in printf format
diff --git a/include/util_script.h b/include/util_script.h
index 9643657c94..3566bd3825 100644
--- a/include/util_script.h
+++ b/include/util_script.h
@@ -155,7 +155,7 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r,
char *buffer,
const char **termch,
int *termarg, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Read headers strings from a script, ensuring that the output is valid. If
@@ -178,7 +178,7 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs_ex(request_rec *r,
int module_index,
const char **termch,
int *termarg, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**