diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-06 04:42:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-06 04:42:30 +0400 |
commit | 39a96e9e3fab5347497da004e71227c651e8604e (patch) | |
tree | 796eb7baafb085236eb8870dbcca4f752513cc83 | |
parent | ba470956274cc4086ee153e4f9bdda9d2ff714f5 (diff) |
disable padding warning for DNA, gave problems with struct bounds padding which DNA ignores.
tag operator callbacks as needing their return values used. These are not directly called in many places so the inconvenience is minimal.
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 14 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 18 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 25 |
5 files changed, 52 insertions, 15 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index f1ee8f522d9..5a79368ac49 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2372,7 +2372,8 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) static int wpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) { - + int retval; + op->customdata = paint_stroke_new(C, NULL, wpaint_stroke_test_start, wpaint_stroke_update_step, wpaint_stroke_done, event->type); @@ -2380,7 +2381,9 @@ static int wpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) /* add modal handler */ WM_event_add_modal_handler(C, op); - op->type->modal(C, op, event); + retval = op->type->modal(C, op, event); + OPERATOR_RETVAL_CHECK(retval); + BLI_assert(retval == OPERATOR_RUNNING_MODAL); return OPERATOR_RUNNING_MODAL; } @@ -2816,7 +2819,8 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) { - + int retval; + op->customdata = paint_stroke_new(C, NULL, vpaint_stroke_test_start, vpaint_stroke_update_step, vpaint_stroke_done, event->type); @@ -2824,7 +2828,9 @@ static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event) /* add modal handler */ WM_event_add_modal_handler(C, op); - op->type->modal(C, op, event); + retval = op->type->modal(C, op, event); + OPERATOR_RETVAL_CHECK(retval); + BLI_assert(retval == OPERATOR_RUNNING_MODAL); return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ec0478d128f..3d3e86d2acb 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3998,6 +3998,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even { struct PaintStroke *stroke; int ignore_background_click; + int retval; if (!sculpt_brush_stroke_init(C, op)) return OPERATOR_CANCELLED; @@ -4021,7 +4022,9 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even /* add modal handler */ WM_event_add_modal_handler(C, op); - op->type->modal(C, op, event); + retval = op->type->modal(C, op, event); + OPERATOR_RETVAL_CHECK(retval); + BLI_assert(retval == OPERATOR_RUNNING_MODAL); return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 88c5ea3e910..494cb875169 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -1186,6 +1186,9 @@ int main(int argc, char **argv) return(return_status); } +/* handy but fails on struct bounds which makesdna doesnt care about + * unless structs are nested */ +#if 0 /* include files for automatic dependencies */ /* extra safety check that we are aligned, @@ -1194,6 +1197,8 @@ int main(int argc, char **argv) # pragma GCC diagnostic error "-Wpadded" #endif +#endif /* if 0 */ + #include "DNA_listBase.h" #include "DNA_vec_types.h" #include "DNA_ID.h" diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 2aa0d83f234..ad828cef6d5 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -509,7 +509,11 @@ 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 *); + int (*exec)(struct bContext *, struct wmOperator *) +#ifdef __GNUC__ + __attribute__((warn_unused_result)) +#endif + ; /* this callback executes on a running operator whenever as property * is changed. It can correct its own properties or report errors for @@ -521,9 +525,17 @@ 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 *, struct wmEvent *); + int (*invoke)(struct bContext *, struct wmOperator *, struct wmEvent *) +#ifdef __GNUC__ + __attribute__((warn_unused_result)) +#endif + ; int (*cancel)(struct bContext *, struct wmOperator *); - int (*modal)(struct bContext *, struct wmOperator *, struct wmEvent *); + int (*modal)(struct bContext *, struct wmOperator *, struct wmEvent *) +#ifdef __GNUC__ + __attribute__((warn_unused_result)) +#endif + ; /* 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 */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9de3c15d70f..e4d6b3dd465 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2289,6 +2289,8 @@ static int border_apply_rect(wmOperator *op) static int border_apply(bContext *C, wmOperator *op, int gesture_mode) { + int retval; + if (!border_apply_rect(op)) return 0; @@ -2296,7 +2298,9 @@ static int border_apply(bContext *C, wmOperator *op, int gesture_mode) if (RNA_struct_find_property(op->ptr, "gesture_mode") ) RNA_int_set(op->ptr, "gesture_mode", gesture_mode); - op->type->exec(C, op); + retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + return 1; } @@ -2422,8 +2426,11 @@ static void gesture_circle_apply(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "y", rect->ymin); RNA_int_set(op->ptr, "radius", rect->xmax); - if (op->type->exec) - op->type->exec(C, op); + if (op->type->exec) { + int retval; + retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + } #ifdef GESTURE_MEMORY circle_select_size = rect->xmax; #endif @@ -2643,8 +2650,10 @@ static void gesture_lasso_apply(bContext *C, wmOperator *op) wm_gesture_end(C, op); - if (op->type->exec) - op->type->exec(C, op); + if (op->type->exec) { + int retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + } } int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) @@ -2813,8 +2822,10 @@ static int straightline_apply(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "xend", rect->xmax); RNA_int_set(op->ptr, "yend", rect->ymax); - if (op->type->exec) - op->type->exec(C, op); + if (op->type->exec) { + int retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + } return 1; } |