From ea00b378744f98e38b0c00e97a5c78d9d76d6dd3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 3 Jul 2016 18:48:46 +0100 Subject: Attempt to help gcc out a little --- frontends/amiga/bitmap.c | 10 +++++---- frontends/amiga/font_bullet.c | 9 ++++---- frontends/amiga/gui.c | 52 +++++++++++++++++++++++-------------------- frontends/amiga/gui.h | 4 ++-- frontends/amiga/menu.c | 3 ++- frontends/amiga/misc.c | 2 +- frontends/amiga/plotters.c | 5 +++-- 7 files changed, 47 insertions(+), 38 deletions(-) (limited to 'frontends/amiga') diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index d6d0c76c9..5b8117a63 100644 --- a/frontends/amiga/bitmap.c +++ b/frontends/amiga/bitmap.c @@ -398,9 +398,10 @@ struct bitmap *ami_bitmap_from_datatype(char *filename) return bm; } -static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int width, int height, struct BitMap *friendbm, int type) +static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, + int width, int height, struct BitMap *restrict friendbm, int type) { - struct BitMap *tbm = NULL; + struct BitMap *restrict tbm = NULL; if(bitmap->nativebm) { @@ -473,7 +474,7 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int w if((bitmap->width != width) || (bitmap->height != height)) { - struct BitMap *scaledbm; + struct BitMap *restrict scaledbm; struct BitScaleArgs bsa; int depth = 32; if(type == AMI_NSBM_PALETTEMAPPED) depth = 8; @@ -539,7 +540,8 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap, int w } -static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,int height,struct BitMap *friendbm) +static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap, + int width, int height, struct BitMap *friendbm) { if((bitmap->native != AMI_NSBM_NONE) && (bitmap->native != AMI_NSBM_TRUECOLOUR)) { amiga_bitmap_modified(bitmap); diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c index b0c2999a1..7220cb00a 100644 --- a/frontends/amiga/font_bullet.c +++ b/frontends/amiga/font_bullet.c @@ -136,9 +136,9 @@ static lwc_string *glypharray[0xffff + 1]; static struct List ami_diskfontlib_list; static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, - uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa); + uint16 *restrict char1, uint16 *restrict char2, uint32 x, uint32 y, uint32 emwidth, bool aa); static inline int32 ami_font_width_glyph(struct OutlineFont *ofont, - const uint16 *char1, const uint16 *char2, uint32 emwidth); + const uint16 *restrict char1, const uint16 *restrict char2, uint32 emwidth); static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle, const uint16 *codepoint); static inline ULONG ami_font_unicode_width(const char *string, ULONG length, @@ -530,7 +530,8 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle } static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPort *rp, - uint16 *char1, uint16 *char2, uint32 x, uint32 y, uint32 emwidth, bool aa) + uint16 *restrict char1, uint16 *restrict char2, uint32 x, uint32 y, + uint32 emwidth, bool aa) { struct GlyphMap *glyph; UBYTE *glyphbm; @@ -637,7 +638,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo } static inline int32 ami_font_width_glyph(struct OutlineFont *ofont, - const uint16 *char1, const uint16 *char2, uint32 emwidth) + const uint16 *restrict char1, const uint16 *restrict char2, uint32 emwidth) { int32 char_advance = 0; FIXED kern = 0; diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index 3eafa5952..3b2f03a71 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -219,7 +219,7 @@ static const __attribute__((used)) char *stack_cookie = "\0$STACK:196608\0"; const char * const versvn; const char * const verdate; -void ami_switch_tab(struct gui_window_2 *gwin,bool redraw); +void ami_switch_tab(struct gui_window_2 *gwin, bool redraw); void ami_change_tab(struct gui_window_2 *gwin, int direction); void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs); void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys); @@ -228,13 +228,13 @@ Object *ami_gui_splash_open(void); void ami_gui_splash_close(Object *win_obj); HOOKF(uint32, ami_set_favicon_render_hook, APTR, space, struct gpRender *); HOOKF(uint32, ami_set_throbber_render_hook, APTR, space, struct gpRender *); -bool ami_gui_map_filename(char **remapped, const char *path, const char *file, - const char *map); +bool ami_gui_map_filename(char **remapped, const char *restrict path, const char *restrict file, + const char *restrict map); static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw); static void ami_do_redraw(struct gui_window_2 *g); static void ami_schedule_redraw_remove(struct gui_window_2 *gwin); -static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy); +static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *restrict sy); static void gui_window_set_scroll(struct gui_window *g, int sx, int sy); static void gui_window_remove_caret(struct gui_window *g); static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip); @@ -289,13 +289,14 @@ STRPTR ami_locale_langs(int *codeset) return acceptlangs; } -bool ami_gui_map_filename(char **remapped, const char *path, const char *file, const char *map) +bool ami_gui_map_filename(char **remapped, const char *restrict path, + const char *restrict file, const char *restrict map) { BPTR fh = 0; char *mapfile = NULL; size_t mapfile_size = 0; char buffer[1024]; - char *realfname; + char *restrict realfname; bool found = false; netsurf_mkpath(&mapfile, &mapfile_size, 2, path, map); @@ -386,7 +387,7 @@ bool ami_locate_resource(char *fullpath, const char *file) locale = OpenLocale(NULL); for(i=0;i<10;i++) { - strcpy(fullpath,"PROGDIR:Resources/"); + strcpy(fullpath, "PROGDIR:Resources/"); if(locale->loc_PrefLanguages[i]) { ami_gui_map_filename(&remapped, "PROGDIR:Resources", @@ -839,7 +840,8 @@ static void ami_openscreenfirst(void) ami_theme_throbber_setup(); } -static struct RDArgs *ami_gui_commandline(int *argc, char **argv, int *nargc, char **nargv) +static struct RDArgs *ami_gui_commandline(int *restrict argc, char ** argv, + int *restrict nargc, char ** nargv) { int new_argc = 1; struct RDArgs *args; @@ -1403,8 +1405,8 @@ void ami_gui_free_space_box(struct IBox *bbox) #endif } -static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y, - int space_x, int space_y) +static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, + int *restrict x, int *restrict y, int space_x, int space_y) { int ns_x = space_x; int ns_y = space_y; @@ -1421,7 +1423,7 @@ static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y, return true; } -bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y, +bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y, int mouse_x, int mouse_y) { int ns_x, ns_y; @@ -1598,8 +1600,8 @@ static void ami_gui_menu_update_all(void) } while((node = nnode)); } -static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, - bool scaled) +static void gui_window_get_dimensions(struct gui_window *g, + int *restrict width, int *restrict height, bool scaled) { struct IBox *bbox; if(!g) return; @@ -1844,7 +1846,8 @@ static void ami_gui_refresh_favicon(void *p) * Returns the width of the size gadget as a convenience. */ #ifdef __amigaos4__ -static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, ULONG *width, ULONG *height) +static ULONG ami_get_border_gadget_size(struct gui_window_2 *gwin, + ULONG *restrict width, ULONG *restrict height) { static ULONG sz_gad_width = 0; static ULONG sz_gad_height = 0; @@ -3127,7 +3130,8 @@ void ami_gui_update_hotlist_button(struct gui_window_2 *gwin) } } -static bool ami_gui_hotlist_add(void *userdata, int level, int item, const char *title, nsurl *url, bool is_folder) +static bool ami_gui_hotlist_add(void *userdata, int level, int item, + const char *title, nsurl *url, bool is_folder) { struct ami_gui_tb_userdata *tb_userdata = (struct ami_gui_tb_userdata *)userdata; struct Node *speed_button_node; @@ -4577,10 +4581,10 @@ static void gui_window_destroy(struct gui_window *g) win_destroyed = true; } -static void gui_window_set_title(struct gui_window *g, const char *title) +static void gui_window_set_title(struct gui_window *g, const char *restrict title) { struct Node *node; - char *utf8title; + char *restrict utf8title; if(!g) return; if(!title) return; @@ -4705,11 +4709,11 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw) } static bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects, - const struct rect *new_rect, APTR mempool) + const struct rect *restrict new_rect, APTR mempool) { struct nsObject *node; struct nsObject *nnode; - struct rect *rect; + struct rect *restrict rect; if(IsMinListEmpty(deferred_rects)) return true; @@ -4740,10 +4744,10 @@ static bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_re return true; } -static void gui_window_update_box(struct gui_window *g, const struct rect *rect) +static void gui_window_update_box(struct gui_window *g, const struct rect *restrict rect) { struct nsObject *nsobj; - struct rect *deferred_rect; + struct rect *restrict deferred_rect; if(!g) return; if(ami_gui_window_update_box_deferred_check(g->deferred_rects, rect, @@ -4924,7 +4928,7 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys) *ys /= gwin->gw->scale; } -static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) +static bool gui_window_get_scroll(struct gui_window *g, int *restrict sx, int *restrict sy) { ami_get_hscroll_pos(g->shared, (ULONG *)sx); ami_get_vscroll_pos(g->shared, (ULONG *)sy); @@ -5269,7 +5273,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, /* return the text box at posn x,y in window coordinates x,y are updated to be document co-ordinates */ -bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y) +bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y) { struct IBox *bbox; ULONG xs, ys; @@ -5314,7 +5318,7 @@ BOOL ami_gadget_hit(Object *obj, int x, int y) Object *ami_gui_splash_open(void) { - Object *win_obj, *bm_obj; + Object *restrict win_obj, *restrict bm_obj; struct Window *win; struct Screen *wbscreen = LockPubScreen("Workbench"); uint32 top = 0, left = 0; diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h index 4272920dc..69a103ae9 100644 --- a/frontends/amiga/gui.h +++ b/frontends/amiga/gui.h @@ -182,8 +182,8 @@ void ami_quit_netsurf(void); void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw); STRPTR ami_locale_langs(int *codeset); int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie); -bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *x, ULONG *y); -bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y, +bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y); +bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y, int mouse_x, int mouse_y); BOOL ami_gadget_hit(Object *obj, int x, int y); void ami_gui_history(struct gui_window_2 *gwin, bool back); diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c index 5ae47deda..c7351411c 100644 --- a/frontends/amiga/menu.c +++ b/frontends/amiga/menu.c @@ -564,7 +564,8 @@ void ami_free_menulabs(struct gui_window_2 *gwin) } static void ami_menu_alloc_item(struct gui_window_2 *gwin, int num, UBYTE type, - const char *label, char key, const char *icon, void *func, void *hookdata) + const char *restrict label, char key, const char *restrict icon, + void *restrict func, void *restrict hookdata) { char menu_icon[1024]; diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c index 39a4bbf88..238865120 100755 --- a/frontends/amiga/misc.c +++ b/frontends/amiga/misc.c @@ -85,7 +85,7 @@ APTR ami_misc_itempool_alloc(APTR pool, int size) #endif } -void ami_misc_itempool_free(APTR pool, APTR item, int size) +void ami_misc_itempool_free(APTR restrict pool, APTR restrict item, int size) { #ifdef __amigaos4__ ItemPoolFree(pool, item); diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c index 7e19db7a5..2ad7f2b54 100644 --- a/frontends/amiga/plotters.c +++ b/frontends/amiga/plotters.c @@ -797,8 +797,9 @@ HOOKF(void, ami_bitmap_tile_hook, struct RastPort *, rp, struct BackFillMessage } } -static void ami_bezier(struct bez_point *a, struct bez_point *b, struct bez_point *c, - struct bez_point *d, double t, struct bez_point *p) { +static void ami_bezier(struct bez_point *restrict a, struct bez_point *restrict b, + struct bez_point *restrict c, struct bez_point *restrict d, + double t, struct bez_point *restrict p) { p->x = pow((1 - t), 3) * a->x + 3 * t * pow((1 -t), 2) * b->x + 3 * (1-t) * pow(t, 2)* c->x + pow (t, 3)* d->x; p->y = pow((1 - t), 3) * a->y + 3 * t * pow((1 -t), 2) * b->y + 3 * (1-t) * pow(t, 2)* c->y + pow (t, 3)* d->y; } -- cgit v1.2.3