Build with cast-align=strict, fix warnings

This commit is contained in:
Kim Woelders 2015-01-17 21:07:31 +01:00
parent dccc8cb55b
commit 49d9d22af8
6 changed files with 22 additions and 22 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2007-2020 Kim Woelders
* Copyright (C) 2007-2023 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -70,7 +70,7 @@ FindRootWindow(Display * dpy)
Atom a, at;
int format_ret;
unsigned long bytes_after, num_ret;
unsigned char *retval;
unsigned long *retval;
root_win = DefaultRootWindow(dpy);
@ -82,17 +82,19 @@ FindRootWindow(Display * dpy)
a = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", True);
XGetWindowProperty(dpy, win1, a, 0, 1, False, XA_WINDOW, &at,
&format_ret, &num_ret, &bytes_after, &retval);
&format_ret, &num_ret, &bytes_after,
(unsigned char **)&retval);
if (!retval)
goto done;
win2 = *((Window *) retval);
win2 = retval[0];
XFree(retval);
XGetWindowProperty(dpy, win2, a, 0, 1, False, XA_WINDOW, &at,
&format_ret, &num_ret, &bytes_after, &retval);
&format_ret, &num_ret, &bytes_after,
(unsigned char **)&retval);
if (!retval)
goto done;
win3 = *((Window *) retval);
win3 = retval[0];
XFree(retval);
if (win2 != win3)

View File

@ -1,6 +1,6 @@
/* Parse C expressions for CCCP.
* Copyright (C) 1987, 1992, 1994, 1995 Free Software Foundation.
* Copyright (C) 2003-2011 Kim Woelders
* Copyright (C) 2003-2023 Kim Woelders
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -1056,8 +1056,8 @@ cpp_parse_expr(cpp_reader * pfile)
memcpy((char *)new_stack, (char *)stack, old_size);
}
stack = new_stack;
top = (struct operation *)((char *)new_stack + old_size);
limit = (struct operation *)((char *)new_stack + new_size);
top = (struct operation *)(void *)((char *)new_stack + old_size);
limit = (struct operation *)(void *)((char *)new_stack + new_size);
}
top->flags = flags;
top->rprio = rprio;

View File

@ -17,7 +17,7 @@ AC_DEFUN([EC_C_WARNINGS], [
enable_werror=no)
if test "x$GCC" = "xyes"; then
CFLAGS_WARNINGS="-W -Wall -Waggregate-return -Wcast-align -Wpointer-arith -Wshadow -Wwrite-strings"
CFLAGS_WARNINGS="-W -Wall -Waggregate-return -Wcast-align=strict -Wpointer-arith -Wshadow -Wwrite-strings"
ifelse(ec_c_compile_cpp, no, [
CFLAGS_WARNINGS="$CFLAGS_WARNINGS -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes"
], [

View File

@ -475,8 +475,8 @@ make_gaussian_map(int r)
int x, y;
float t, g;
#ifdef __clang_analyzer__
c = malloc(sizeof(conv) + size * size * sizeof(float));
#if 1 /* Avoid cast-align warnings */
c = (conv *) malloc(sizeof(conv) + size * size * sizeof(float));
#else
c = (conv *) EMALLOC(char, sizeof(conv) + size * size * sizeof(float));
#endif

10
src/x.c
View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2022 Kim Woelders
* Copyright (C) 2004-2023 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -163,15 +163,13 @@ Win
EXidLookup(EX_Window xwin)
{
Win win;
XPointer xp;
if (!xid_context)
return NULL;
xp = NULL;
if (XFindContext(disp, xwin, xid_context, &xp) == XCNOENT)
xp = NULL;
win = (Win) xp;
win = NULL;
if (XFindContext(disp, xwin, xid_context, (XPointer *) & win) == XCNOENT)
win = NULL;
return win;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2022 Kim Woelders
* Copyright (C) 2004-2023 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -133,7 +133,7 @@ static int
_ex_window_prop32_list_get(EX_Window win, EX_Atom atom,
EX_Atom type, unsigned int **val, int num)
{
unsigned char *prop_ret;
unsigned long *prop_ret;
Atom type_ret;
unsigned long bytes_after, num_ret;
int format_ret;
@ -143,7 +143,7 @@ _ex_window_prop32_list_get(EX_Window win, EX_Atom atom,
prop_ret = NULL;
if (XGetWindowProperty(_ex_disp, win, atom, 0, 0x7fffffff, False,
type, &type_ret, &format_ret, &num_ret,
&bytes_after, &prop_ret) != Success)
&bytes_after, (unsigned char **)&prop_ret) != Success)
return -1;
if (type_ret != type || format_ret != 32)
@ -172,7 +172,7 @@ _ex_window_prop32_list_get(EX_Window win, EX_Atom atom,
return 0;
}
for (i = 0; i < num; i++)
lst[i] = ((unsigned long *)prop_ret)[i];
lst[i] = prop_ret[i];
}
if (prop_ret)
XFree(prop_ret);