Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed the gcc __attributes__

Change-Id: Ie4e959a7a179628b2f9033507a6e55ba79461ed8
Reviewed-on: http://review.northscale.com/1516
Tested-by: Dustin Sallings <dustin@spy.net>
Reviewed-by: Dustin Sallings <dustin@spy.net>
  • Loading branch information...
commit 0b06e17af4a04afdb68e3f7dddc8a6d96cfc20de 1 parent 515cc40
Trond Norbye trondn authored dustin committed

Showing 2 changed files with 33 additions and 21 deletions. Show diff stats Hide diff stats

  1. +11 1 alarm.h
  2. +22 20 conflate.h
12 alarm.h
@@ -17,6 +17,16 @@ extern "C" {
17 17 #define ALARM_MSG_MAXLEN 255
18 18 #define ALARM_NAME_MAXLEN 25
19 19
  20 +/* Deal with an ICC annoyance. It tries hard to pretend to be GCC<
  21 + but doesn't understand its attributes properly. */
  22 +#ifndef __libconflate_gcc_attribute__
  23 +#if defined (__ICC) || defined (__SUNPRO_C)
  24 +# define __libconflate_gcc_attribute__(x)
  25 +#else
  26 +# define __libconflate_gcc_attribute__ __attribute__
  27 +#endif
  28 +#endif
  29 +
20 30 /**
21 31 * \addtogroup Alarm
22 32 * @{
@@ -90,7 +100,7 @@ alarm_t get_alarm(alarm_queue_t *queue);
90 100 * @return true iff the alarm was enqueued
91 101 */
92 102 bool add_alarm(alarm_queue_t *queue, const char *name, const char *msg)
93   - __attribute__ ((warn_unused_result));
  103 + __libconflate_gcc_attribute__ ((warn_unused_result));
94 104
95 105 /**
96 106 * Create and initialize an alarm queue.
42 conflate.h
@@ -27,10 +27,12 @@ extern "C" {
27 27
28 28 /* Deal with an ICC annoyance. It tries hard to pretend to be GCC<
29 29 but doesn't understand its attributes properly. */
  30 +#ifndef __libconflate_gcc_attribute__
30 31 #if defined (__ICC) || defined (__SUNPRO_C)
31   -# define __gcc_attribute__(x)
  32 +# define __libconflate_gcc_attribute__(x)
32 33 #else
33   -# define __gcc_attribute__ __attribute__
  34 +# define __libconflate_gcc_attribute__ __attribute__
  35 +#endif
34 36 #endif
35 37
36 38 /* Forward declaration */
@@ -100,7 +102,7 @@ typedef bool (*kvpair_visitor_t)(void *opaque,
100 102 * @return a newly allocated kvpair_t
101 103 */
102 104 kvpair_t* mk_kvpair(const char* k, char** v)
103   - __attribute__ ((warn_unused_result, nonnull (1)));
  105 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull (1)));
104 106
105 107 /**
106 108 * Add a value to a kvpair_t.
@@ -109,7 +111,7 @@ kvpair_t* mk_kvpair(const char* k, char** v)
109 111 * @param value the new value
110 112 */
111 113 void add_kvpair_value(kvpair_t* kvpair, const char* value)
112   - __attribute__ ((nonnull (1, 2)));
  114 + __libconflate_gcc_attribute__ ((nonnull (1, 2)));
113 115
114 116 /**
115 117 * Find a kvpair with the given key.
@@ -120,7 +122,7 @@ void add_kvpair_value(kvpair_t* kvpair, const char* value)
120 122 * @return the pair with the given key, or NULL if no such pair is found
121 123 */
122 124 kvpair_t* find_kvpair(kvpair_t* pair, const char* key)
123   - __attribute__ ((warn_unused_result, nonnull (2)));
  125 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull (2)));
124 126
125 127 /**
126 128 * Find a simple value from a kvpair list.
@@ -135,7 +137,7 @@ kvpair_t* find_kvpair(kvpair_t* pair, const char* key)
135 137 * @return a pointer to the first value found, or NULL if none was found
136 138 */
137 139 char *get_simple_kvpair_val(kvpair_t *pair, const char *key)
138   - __attribute__ ((warn_unused_result, nonnull (2)));
  140 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull (2)));
139 141
140 142 /**
141 143 * Copy a chain of kvpairs.
@@ -145,7 +147,7 @@ char *get_simple_kvpair_val(kvpair_t *pair, const char *key)
145 147 * @return a complete deep copy of the kvpair structure
146 148 */
147 149 kvpair_t *dup_kvpair(kvpair_t *pair)
148   - __attribute__ ((warn_unused_result, nonnull (1)));
  150 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull (1)));
149 151
150 152 /**
151 153 * Walk a kvpair.
@@ -155,7 +157,7 @@ kvpair_t *dup_kvpair(kvpair_t *pair)
155 157 * @param visitor the visitor to call for each kvpair_t
156 158 */
157 159 void walk_kvpair(kvpair_t *pair, void *opaque, kvpair_visitor_t visitor)
158   - __attribute__ ((nonnull(1, 3)));
  160 + __libconflate_gcc_attribute__ ((nonnull(1, 3)));
159 161
160 162 /**
161 163 * Free a chain of kvpairs.
@@ -196,7 +198,7 @@ typedef struct _conflate_form_result conflate_form_result;
196 198 * @param v a form value (may not be NULL)
197 199 */
198 200 void conflate_add_field(conflate_form_result *r, const char *k, const char *v)
199   - __attribute__ ((nonnull (1, 2, 3)));
  201 + __libconflate_gcc_attribute__ ((nonnull (1, 2, 3)));
200 202
201 203 /**
202 204 * Add a multi-valued key to a response form.
@@ -207,7 +209,7 @@ void conflate_add_field(conflate_form_result *r, const char *k, const char *v)
207 209 */
208 210 void conflate_add_field_multi(conflate_form_result *r, const char *k,
209 211 const char **v)
210   - __attribute__ ((nonnull (1, 2, 3)));
  212 + __libconflate_gcc_attribute__ ((nonnull (1, 2, 3)));
211 213
212 214 /**
213 215 * Create a response container for a multi-set response.
@@ -218,7 +220,7 @@ void conflate_add_field_multi(conflate_form_result *r, const char *k,
218 220 * @param r the form as handed to the callback
219 221 */
220 222 void conflate_next_fieldset(conflate_form_result *r)
221   - __attribute__ ((nonnull (1)));
  223 + __libconflate_gcc_attribute__ ((nonnull (1)));
222 224
223 225 /**
224 226 * Initialize the result form if it's not already initialized.
@@ -282,7 +284,7 @@ typedef enum conflate_mgmt_cb_result (*conflate_mgmt_cb_t)(void *opaque,
282 284 */
283 285 void conflate_register_mgmt_cb(const char *cmd, const char *desc,
284 286 conflate_mgmt_cb_t cb)
285   - __attribute__ ((nonnull (1, 2, 3)));
  287 + __libconflate_gcc_attribute__ ((nonnull (1, 2, 3)));
286 288
287 289 /**
288 290 * @}
@@ -396,7 +398,7 @@ typedef struct {
396 398 * @param msg the message to log
397 399 */
398 400 void (*log)(void *udata, enum conflate_log_level level, const char *msg, ...)
399   - __gcc_attribute__ ((format (printf, 3, 4)));
  401 + __libconflate_gcc_attribute__ ((format (printf, 3, 4)));
400 402
401 403 /**
402 404 * Callback issued when a new configuration is to be activated.
@@ -430,7 +432,7 @@ typedef struct {
430 432 *
431 433 * @param conf configuration to be initialized
432 434 */
433   -void init_conflate(conflate_config_t *conf) __attribute__ ((nonnull (1)));
  435 +void init_conflate(conflate_config_t *conf) __libconflate_gcc_attribute__ ((nonnull (1)));
434 436
435 437 /**
436 438 * The main entry point for starting a conflate agent.
@@ -439,7 +441,7 @@ void init_conflate(conflate_config_t *conf) __attribute__ ((nonnull (1)));
439 441 *
440 442 * @return true if libconflate was able to properly initialize itself
441 443 */
442   -bool start_conflate(conflate_config_t conf) __attribute__ ((warn_unused_result));
  444 +bool start_conflate(conflate_config_t conf) __libconflate_gcc_attribute__ ((warn_unused_result));
443 445
444 446 /**
445 447 * @}
@@ -472,7 +474,7 @@ conflate_config_t* dup_conf(conflate_config_t c);
472 474 * @return the config, or NULL if the config could not be read for any reason
473 475 */
474 476 kvpair_t* load_kvpairs(conflate_handle_t *handle, const char *filename)
475   - __attribute__ ((warn_unused_result, nonnull(1, 2)));
  477 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull(1, 2)));
476 478
477 479 /**
478 480 * Save a config at the given path.
@@ -484,7 +486,7 @@ kvpair_t* load_kvpairs(conflate_handle_t *handle, const char *filename)
484 486 * @return false if the configuration could not be saved for any reason
485 487 */
486 488 bool save_kvpairs(conflate_handle_t *handle, kvpair_t* pairs, const char *filename)
487   - __attribute__ ((warn_unused_result, nonnull(1, 2, 3)));
  489 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull(1, 2, 3)));
488 490
489 491 /**
490 492 * Save some instance-private data.
@@ -498,7 +500,7 @@ bool save_kvpairs(conflate_handle_t *handle, kvpair_t* pairs, const char *filena
498 500 */
499 501 bool conflate_save_private(conflate_handle_t *handle,
500 502 const char *k, const char *v, const char *filename)
501   - __attribute__ ((warn_unused_result, nonnull(1, 2, 3, 4)));
  503 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull(1, 2, 3, 4)));
502 504
503 505 /**
504 506 * Delete some saved instance-private data.
@@ -511,7 +513,7 @@ bool conflate_save_private(conflate_handle_t *handle,
511 513 */
512 514 bool conflate_delete_private(conflate_handle_t *handle,
513 515 const char *k, const char *filename)
514   - __attribute__ ((warn_unused_result, nonnull(1, 2, 3)));
  516 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull(1, 2, 3)));
515 517
516 518 /**
517 519 * Get some saved instance-private data.
@@ -524,7 +526,7 @@ bool conflate_delete_private(conflate_handle_t *handle,
524 526 */
525 527 char *conflate_get_private(conflate_handle_t *handle,
526 528 const char *k, const char *filename)
527   - __attribute__ ((warn_unused_result, nonnull(1, 2, 3)));
  529 + __libconflate_gcc_attribute__ ((warn_unused_result, nonnull(1, 2, 3)));
528 530
529 531 /**
530 532 * @}

0 comments on commit 0b06e17

Please sign in to comment.
Something went wrong with that request. Please try again.