[Xcb] [PATCH] cursor: Fix issue with gcc

Uli Schlachter psychon at znc.in
Sun Apr 24 18:47:37 UTC 2016


CC'ing Michael Stapelberg, since this is "mostly his library".

Am 21.04.2016 um 17:45 schrieb Stefan Dirsch:
> From: Kristoffer Grönlund <krig at koru.se>
> 
> cursor_shape_to_id should not be declared const, else it is not added
> to the static library.

Huh? Why not? What does GCC do different for static libraries? What does GCC
even have to do with libraries at all (instead of e.g. the linker)? What does
"not addeed to the static library" mean? What exactly are you doing and what's
the error message?

(Note that static libraries contain .o files and not functions...)

Also: "Fix issue with gcc": Sorry, but my gcc works fine here, could you be more
specific.

> ---
>  cursor/cursor.h          | 2 +-
>  cursor/shape_to_id.gperf | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/cursor/cursor.h b/cursor/cursor.h
> index 455dc34..3fe7096 100644
> --- a/cursor/cursor.h
> +++ b/cursor/cursor.h
> @@ -161,7 +161,7 @@ typedef struct xcint_image_t {
>  } __attribute__((packed)) xcint_image_t;
>  
>  /* shape_to_id.c */
> -const int cursor_shape_to_id(const char *name);
> +int cursor_shape_to_id(const char *name);
>  
>  /* parse_cursor_file.c */
>  int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **images, int *nimg);
> diff --git a/cursor/shape_to_id.gperf b/cursor/shape_to_id.gperf
> index 23615f9..6c8818e 100644
> --- a/cursor/shape_to_id.gperf
> +++ b/cursor/shape_to_id.gperf
> @@ -1,5 +1,5 @@
>  struct shape_mapping { const char *name; int number; };
> -const int cursor_shape_to_id(const char *name);
> +int cursor_shape_to_id(const char *name);
>  %%
>  X_cursor,0
>  arrow,1
> @@ -79,7 +79,7 @@ ur_angle,74
>  watch,75
>  xterm,76
>  %%
> -const int cursor_shape_to_id(const char *name) {
> +int cursor_shape_to_id(const char *name) {
>  	struct shape_mapping *mapping = in_word_set(name, strlen(name));
>  	return (mapping ? (mapping->number * 2) : -1);
>  }
> 


-- 
Happiness can't be found -- it finds you.
 - Majic


More information about the Xcb mailing list