Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-09-01 19:01:15 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-09-01 19:01:15 +0400
commit35b61a7512dc1b8b1d8bc562aad2a72d254b8a69 (patch)
tree5050db48823af6cf23eee62b5a013e2f208fdded /source/blender/windowmanager
parent901dea87a1266479d3b7aab6cfd2d5fbf6adc393 (diff)
Move GCC attributes into a centraized defines
Instead of having ifdef __GNUC__ all over the headers to use special compiler's hints use a special file where all things like this are concentrated. Makes code easier to follow and allows to manage special attributes in more efficient way. Thanks Campbell for review!
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h19
-rw-r--r--source/blender/windowmanager/WM_types.h33
2 files changed, 11 insertions, 41 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 2a8358f832a..455fbf4e50a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -40,6 +40,7 @@
/* dna-savable wmStructs here */
#include "DNA_windowmanager_types.h"
#include "WM_keymap.h"
+#include "BLI_compiler_attrs.h"
#ifdef __cplusplus
extern "C" {
@@ -76,17 +77,9 @@ void WM_init_native_pixels(bool do_it);
void WM_init (struct bContext *C, int argc, const char **argv);
void WM_exit_ext (struct bContext *C, const short do_python);
-void WM_exit (struct bContext *C)
-#if defined(__GNUC__) || defined(__clang__)
-__attribute__((noreturn))
-#endif
-;
+void WM_exit (struct bContext *C) ATTR_NORETURN;
-void WM_main (struct bContext *C)
-#if defined(__GNUC__) || defined(__clang__)
-__attribute__((noreturn))
-#endif
-;
+void WM_main (struct bContext *C) ATTR_NORETURN;
bool WM_init_game (struct bContext *C);
void WM_init_splash (struct bContext *C);
@@ -180,11 +173,7 @@ void WM_main_remove_notifier_reference(const void *reference);
/* reports */
void WM_report(const struct bContext *C, ReportType type, const char *message);
-void WM_reportf(const struct bContext *C, ReportType type, const char *format, ...)
-#ifdef __GNUC__
-__attribute__ ((format(printf, 3, 4)))
-#endif
-;
+void WM_reportf(const struct bContext *C, ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(3, 4);
void wm_event_add(struct wmWindow *win, const struct wmEvent *event_to_add);
void wm_event_init_from_window(struct wmWindow *win, struct wmEvent *event);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index f1932c8aa97..e6b6df11d7d 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -115,6 +115,7 @@ struct ImBuf;
#include "RNA_types.h"
#include "DNA_listBase.h"
+#include "BLI_compiler_attrs.h"
/* exported types for WM */
#include "wm_cursors.h"
@@ -522,12 +523,8 @@ typedef struct wmOperatorType {
* parameters may be provided through operator properties. cannot use
* any interface code or input device state.
* - see defines below for return values */
- int (*exec)(struct bContext *, struct wmOperator *)
-#ifdef __GNUC__
- __attribute__((warn_unused_result))
-#endif
- ;
-
+ int (*exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT;
+
/* this callback executes on a running operator whenever as property
* is changed. It can correct its own properties or report errors for
* invalid settings in exceptional cases.
@@ -538,25 +535,13 @@ typedef struct wmOperatorType {
* any further events are handled in modal. if the operation is
* canceled due to some external reason, cancel is called
* - see defines below for return values */
- int (*invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *)
-#ifdef __GNUC__
- __attribute__((warn_unused_result))
-#endif
- ;
+ int (*invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT;
int (*cancel)(struct bContext *, struct wmOperator *);
- int (*modal)(struct bContext *, struct wmOperator *, const struct wmEvent *)
-#ifdef __GNUC__
- __attribute__((warn_unused_result))
-#endif
- ;
+ int (*modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT;
/* verify if the operator can be executed in the current context, note
* that the operator might still fail to execute even if this return true */
- int (*poll)(struct bContext *)
-#ifdef __GNUC__
- __attribute__((warn_unused_result))
-#endif
- ;
+ int (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
/* optional panel for redo and repeat, autogenerated if not set */
void (*ui)(struct bContext *, struct wmOperator *);
@@ -580,11 +565,7 @@ typedef struct wmOperatorType {
/* only used for operators defined with python
* use to store pointers to python functions */
void *pyop_data;
- int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot)
-#ifdef __GNUC__
- __attribute__((warn_unused_result))
-#endif
- ;
+ int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT;
/* RNA integration */
ExtensionRNA ext;