Skip to content

Commit 8f0e8a8

Browse files
author
Stefan Fritsch
committed
Avoid "`sentinel' attribute directive ignored" warning with gcc 3.x
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1134906 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4413902 commit 8f0e8a8

6 files changed

Lines changed: 18 additions & 11 deletions

File tree

include/ap_config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,13 @@
173173
#define AP_HAVE_DESIGNATED_INITIALIZER
174174
#endif
175175

176+
#ifndef __has_attribute /* check for supported attributes on clang */
177+
#define __has_attribute(x) 0
178+
#endif
179+
#if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
180+
#define ap_func_attr_sentinel __attribute__((sentinel))
181+
#else
182+
#define ap_func_attr_sentinel
183+
#endif
184+
176185
#endif /* AP_CONFIG_H */

include/http_protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static inline int ap_rputs(const char *str, request_rec *r)
346346
* @return The number of bytes sent
347347
*/
348348
AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...)
349-
__attribute__((sentinel));
349+
ap_func_attr_sentinel;
350350

351351
/**
352352
* Output data to the client in a printf format

include/http_request.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ AP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime);
285285
* @return None.
286286
*/
287287
AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
288-
__attribute__((sentinel));
288+
ap_func_attr_sentinel;
289289

290290
/**
291291
* Add one or more methods to the list permitted to access the resource.

include/util_cookies.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ typedef struct {
6868
AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name,
6969
const char *val, const char *attrs,
7070
long maxage, ...)
71-
__attribute__((sentinel));
71+
ap_func_attr_sentinel;
7272

7373
/**
7474
* Write an RFC2965 compliant cookie.
@@ -85,7 +85,7 @@ AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name,
8585
AP_DECLARE(apr_status_t) ap_cookie_write2(request_rec * r, const char *name2,
8686
const char *val, const char *attrs2,
8787
long maxage, ...)
88-
__attribute__((sentinel));
88+
ap_func_attr_sentinel;
8989

9090
/**
9191
* Remove an RFC2109 compliant cookie.
@@ -99,7 +99,7 @@ AP_DECLARE(apr_status_t) ap_cookie_write2(request_rec * r, const char *name2,
9999
*/
100100
AP_DECLARE(apr_status_t) ap_cookie_remove(request_rec * r, const char *name,
101101
const char *attrs, ...)
102-
__attribute__((sentinel));
102+
ap_func_attr_sentinel;
103103

104104
/**
105105
* Remove an RFC2965 compliant cookie.
@@ -113,7 +113,7 @@ AP_DECLARE(apr_status_t) ap_cookie_remove(request_rec * r, const char *name,
113113
*/
114114
AP_DECLARE(apr_status_t) ap_cookie_remove2(request_rec * r, const char *name2,
115115
const char *attrs2, ...)
116-
__attribute__((sentinel));
116+
ap_func_attr_sentinel;
117117

118118
/**
119119
* Read a cookie called name, placing its value in val.

include/util_filter.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,7 @@ AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb);
547547
AP_DECLARE_NONSTD(apr_status_t) ap_fputstrs(ap_filter_t *f,
548548
apr_bucket_brigade *bb,
549549
...)
550-
#if defined(__GNUC__) && __GNUC__ >= 4
551-
__attribute__((sentinel))
552-
#endif
553-
;
550+
ap_func_attr_sentinel;
554551

555552
/**
556553
* Output data to the filter in printf format

include/util_script.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define APACHE_UTIL_SCRIPT_H
2828

2929
#include "apr_buckets.h"
30+
#include "ap_config.h"
3031

3132
#ifdef __cplusplus
3233
extern "C" {
@@ -123,7 +124,7 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r,
123124
char *buffer,
124125
const char **termch,
125126
int *termarg, ...)
126-
__attribute__((sentinel));
127+
ap_func_attr_sentinel;
127128

128129
/**
129130
* Read headers output from a script, ensuring that the output is valid. If

0 commit comments

Comments
 (0)