Index: config.h.in =================================================================== --- config.h.in (revision 3512) +++ config.h.in (revision 3513) @@ -40,6 +40,10 @@ /* These ones are already autodetected by scconfig */ @] +print {\n\n/* Macro to add a funciton attribute to suppress "function unused" for static inline functions declared in .h files */\n} +print_ternary cc/func_attr/unused/presents {#define PCB_FUNC_UNUSED __attribute__((unused))} {#define PCB_FUNC_UNUSED} + + print {\n\n/* Define to 1 if you have the `snprintf' function. */\n} print_ternary libs/snprintf {#define HAVE_SNPRINTF 1} {/* #undef HAVE_SNPRINTF */} Index: scconfig/Rev.h =================================================================== --- scconfig/Rev.h (revision 3512) +++ scconfig/Rev.h (revision 3513) @@ -1 +1 @@ -static const int myrev = 3510; +static const int myrev = 3513; Index: scconfig/Rev.tab =================================================================== --- scconfig/Rev.tab (revision 3512) +++ scconfig/Rev.tab (revision 3513) @@ -1,3 +1,4 @@ +3513 configure rename detect gcc attribute "unused" and use it for static inline local functions 3510 configure rename the debug plugin to diag plugin to avoid confusion with --debug in ./configure 3509 configure solve non-c89-compliant function pointer <-> data pointer casts 3361 configure cleanup: layer.c is compiled into layer.o now Index: scconfig/hooks.c =================================================================== --- scconfig/hooks.c (revision 3512) +++ scconfig/hooks.c (revision 3513) @@ -220,6 +220,7 @@ if (istrue(get("/local/pcb/debug"))) require("cc/argstd/*", 0, 0); + require("cc/func_attr/unused/*", 0, 0); require("cc/inline", 0, 0); return 0; Index: src/box.h =================================================================== --- src/box.h (revision 3512) +++ src/box.h (revision 3513) @@ -92,27 +92,27 @@ /* note that boxes are closed on top and left and open on bottom and right. */ /* this means that top-left corner is in box, *but bottom-right corner is * not*. */ -static inline pcb_bool point_in_box(const BoxType * box, Coord X, Coord Y) +static inline PCB_FUNC_UNUSED pcb_bool point_in_box(const BoxType * box, Coord X, Coord Y) { return (X >= box->X1) && (Y >= box->Y1) && (X < box->X2) && (Y < box->Y2); } -static inline pcb_bool point_in_closed_box(const BoxType * box, Coord X, Coord Y) +static inline PCB_FUNC_UNUSED pcb_bool point_in_closed_box(const BoxType * box, Coord X, Coord Y) { return (X >= box->X1) && (Y >= box->Y1) && (X <= box->X2) && (Y <= box->Y2); } -static inline pcb_bool box_is_good(const BoxType * b) +static inline PCB_FUNC_UNUSED pcb_bool box_is_good(const BoxType * b) { return (b->X1 < b->X2) && (b->Y1 < b->Y2); } -static inline pcb_bool box_intersect(const BoxType * a, const BoxType * b) +static inline PCB_FUNC_UNUSED pcb_bool box_intersect(const BoxType * a, const BoxType * b) { return (a->X1 < b->X2) && (b->X1 < a->X2) && (a->Y1 < b->Y2) && (b->Y1 < a->Y2); } -static inline CheapPointType closest_point_in_box(const CheapPointType * from, const BoxType * box) +static inline PCB_FUNC_UNUSED CheapPointType closest_point_in_box(const CheapPointType * from, const BoxType * box) { CheapPointType r; assert(box->X1 < box->X2 && box->Y1 < box->Y2); @@ -122,12 +122,12 @@ return r; } -static inline pcb_bool box_in_box(const BoxType * outer, const BoxType * inner) +static inline PCB_FUNC_UNUSED pcb_bool box_in_box(const BoxType * outer, const BoxType * inner) { return (outer->X1 <= inner->X1) && (inner->X2 <= outer->X2) && (outer->Y1 <= inner->Y1) && (inner->Y2 <= outer->Y2); } -static inline BoxType clip_box(const BoxType * box, const BoxType * clipbox) +static inline PCB_FUNC_UNUSED BoxType clip_box(const BoxType * box, const BoxType * clipbox) { BoxType r; assert(box_intersect(box, clipbox)); @@ -139,7 +139,7 @@ return r; } -static inline BoxType shrink_box(const BoxType * box, Coord amount) +static inline PCB_FUNC_UNUSED BoxType shrink_box(const BoxType * box, Coord amount) { BoxType r = *box; r.X1 += amount; @@ -149,13 +149,13 @@ return r; } -static inline BoxType bloat_box(const BoxType * box, Coord amount) +static inline PCB_FUNC_UNUSED BoxType bloat_box(const BoxType * box, Coord amount) { return shrink_box(box, -amount); } /* construct a minimum box that touches the input box at the center */ -static inline BoxType box_center(const BoxType * box) +static inline PCB_FUNC_UNUSED BoxType box_center(const BoxType * box) { BoxType r; r.X1 = box->X1 + (box->X2 - box->X1) / 2; @@ -166,7 +166,7 @@ } /* construct a minimum box that touches the input box at the corner */ -static inline BoxType box_corner(const BoxType * box) +static inline PCB_FUNC_UNUSED BoxType box_corner(const BoxType * box) { BoxType r; r.X1 = box->X1; @@ -177,7 +177,7 @@ } /* construct a box that holds a single point */ -static inline BoxType point_box(Coord X, Coord Y) +static inline PCB_FUNC_UNUSED BoxType point_box(Coord X, Coord Y) { BoxType r; r.X1 = X; @@ -188,7 +188,7 @@ } /* close a bounding box by pushing its upper right corner */ -static inline void close_box(BoxType * r) +static inline PCB_FUNC_UNUSED void close_box(BoxType * r) { r->X2++; r->Y2++; @@ -197,7 +197,7 @@ /* return the square of the minimum distance from a point to some point * inside a box. The box is half-closed! That is, the top-left corner * is considered in the box, but the bottom-right corner is not. */ -static inline double dist2_to_box(const CheapPointType * p, const BoxType * b) +static inline PCB_FUNC_UNUSED double dist2_to_box(const CheapPointType * p, const BoxType * b) { CheapPointType r = closest_point_in_box(p, b); return Distance(r.X, r.Y, p->X, p->Y); Index: src_plugins/export_gcode/auxiliary.h =================================================================== --- src_plugins/export_gcode/auxiliary.h (revision 3512) +++ src_plugins/export_gcode/auxiliary.h (revision 3513) @@ -24,7 +24,7 @@ typedef potrace_dpoint_t dpoint_t; /* convert point_t to dpoint_t */ -static inline dpoint_t dpoint(point_t p) +static inline PCB_FUNC_UNUSED dpoint_t dpoint(point_t p) { dpoint_t res; res.x = p.x; @@ -33,7 +33,7 @@ } /* range over the straight line segment [a,b] when lambda ranges over [0,1] */ -static inline dpoint_t interval(double lambda, dpoint_t a, dpoint_t b) +static inline PCB_FUNC_UNUSED dpoint_t interval(double lambda, dpoint_t a, dpoint_t b) { dpoint_t res; @@ -53,12 +53,12 @@ /* integer arithmetic */ -static inline int mod(int a, int n) +static inline PCB_FUNC_UNUSED int mod(int a, int n) { return a >= n ? a % n : a >= 0 ? a : n - 1 - (-1 - a) % n; } -static inline int floordiv(int a, int n) +static inline PCB_FUNC_UNUSED int floordiv(int a, int n) { return a >= 0 ? a / n : -1 - (-1 - a) / n; } Index: src_plugins/export_gcode/bitmap.h =================================================================== --- src_plugins/export_gcode/bitmap.h (revision 3512) +++ src_plugins/export_gcode/bitmap.h (revision 3513) @@ -46,7 +46,7 @@ #define BM_PUT(bm, x, y, b) (bm_safe(bm, x, y) ? BM_UPUT(bm, x, y, b) : 0) /* free the given bitmap. Leaves errno untouched. */ -static inline void bm_free(potrace_bitmap_t * bm) +static inline PCB_FUNC_UNUSED void bm_free(potrace_bitmap_t * bm) { if (bm) { free(bm->map); @@ -55,7 +55,7 @@ } /* return new un-initialized bitmap. NULL with errno on error */ -static inline potrace_bitmap_t *bm_new(int w, int h) +static inline PCB_FUNC_UNUSED potrace_bitmap_t *bm_new(int w, int h) { potrace_bitmap_t *bm; int dy = (w + BM_WORDBITS - 1) / BM_WORDBITS; @@ -76,13 +76,13 @@ } /* clear the given bitmap. Set all bits to c. */ -static inline void bm_clear(potrace_bitmap_t * bm, int c) +static inline PCB_FUNC_UNUSED void bm_clear(potrace_bitmap_t * bm, int c) { memset(bm->map, c ? -1 : 0, bm->dy * bm->h * BM_WORDSIZE); } /* duplicate the given bitmap. Return NULL on error with errno set. */ -static inline potrace_bitmap_t *bm_dup(const potrace_bitmap_t * bm) +static inline PCB_FUNC_UNUSED potrace_bitmap_t *bm_dup(const potrace_bitmap_t * bm) { potrace_bitmap_t *bm1 = bm_new(bm->w, bm->h); if (!bm1) { @@ -93,7 +93,7 @@ } /* invert the given bitmap. */ -static inline void bm_invert(potrace_bitmap_t * bm) +static inline PCB_FUNC_UNUSED void bm_invert(potrace_bitmap_t * bm) { int i; for (i = 0; i < bm->dy * bm->h; i++) { Index: src_plugins/hid_lesstif/menu.c =================================================================== --- src_plugins/hid_lesstif/menu.c (revision 3512) +++ src_plugins/hid_lesstif/menu.c (revision 3513) @@ -552,6 +552,9 @@ } #endif +static int need_xy = 0, have_xy = 0, action_x, action_y; + +#if 0 typedef struct ToggleItem { struct ToggleItem *next; Widget w; @@ -561,8 +564,6 @@ } ToggleItem; static ToggleItem *toggle_items = 0; -static int need_xy = 0, have_xy = 0, action_x, action_y; - static void radio_callback(Widget toggle, ToggleItem * me, XmToggleButtonCallbackStruct * cbs) { if (!cbs->set) /* uh uh, can't turn it off */ @@ -579,6 +580,7 @@ me->callback(toggle, me->node, cbs); } } +#endif int lesstif_button_event(Widget w, XEvent * e) { Index: src_plugins/mincut/pcb-mincut/graph.h =================================================================== --- src_plugins/mincut/pcb-mincut/graph.h (revision 3512) +++ src_plugins/mincut/pcb-mincut/graph.h (revision 3513) @@ -20,6 +20,7 @@ #define GRAPH_H #include #include +#include "../../../config.h" typedef struct gr_s { int n; /* number of nodes */ @@ -37,7 +38,7 @@ void gr_free(gr_t *g); -static inline void gr_bound_chk(gr_t *g, int n1, int n2) +static inline PCB_FUNC_UNUSED void gr_bound_chk(gr_t *g, int n1, int n2) { assert((n1 >= 0) && (n1 < g->n)); assert((n2 >= 0) && (n2 < g->n)); @@ -44,13 +45,13 @@ } /* return number of edges between nodes n1 and n2 - without checks */ -static inline int gr_get_(gr_t *g, int n1, int n2) +static inline PCB_FUNC_UNUSED int gr_get_(gr_t *g, int n1, int n2) { return g->adj[n1 * g->n + n2]; } /* return number of edges between nodes n1 and n2 - with checks */ -static inline int gr_get(gr_t *g, int n1, int n2) +static inline PCB_FUNC_UNUSED int gr_get(gr_t *g, int n1, int n2) { gr_bound_chk(g, n1, n2); return gr_get_(g, n1, n2); @@ -57,7 +58,7 @@ } /* return old number of edges between nodes n1 and n2 and change it to newnum - no check*/ -static inline int gr_set_(gr_t *g, int n1, int n2, int newnum) +static inline PCB_FUNC_UNUSED int gr_set_(gr_t *g, int n1, int n2, int newnum) { int old; old = g->adj[n1 * g->n + n2]; @@ -67,7 +68,7 @@ } /* return old number of edges between nodes n1 and n2 and increase it by newnum - no check*/ -static inline int gr_add_(gr_t *g, int n1, int n2, int newnum) +static inline PCB_FUNC_UNUSED int gr_add_(gr_t *g, int n1, int n2, int newnum) { int old; old = g->adj[n1 * g->n + n2]; @@ -77,7 +78,7 @@ } /* return old number of edges between nodes n1 and n2 and change it to newnum - check*/ -static inline int gr_set(gr_t *g, int n1, int n2, int newnum) +static inline PCB_FUNC_UNUSED int gr_set(gr_t *g, int n1, int n2, int newnum) { gr_bound_chk(g, n1, n2); return gr_set_(g, n1, n2, newnum);