[CMake] fix clang -Wcast-align warnings in lemon.c
parent
177f5509bd
commit
ed3065cfb2
|
@ -527,10 +527,6 @@ if(WIN32)
|
|||
endif()
|
||||
|
||||
add_executable(lemon lemon.c)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
# yeah, lemon is a mess... but: it only needs to run at compile time
|
||||
add_target_properties(lemon COMPILE_FLAGS -Wno-cast-align)
|
||||
endif()
|
||||
|
||||
## Build parsers by using lemon...
|
||||
lemon_parser(configparser.y)
|
||||
|
|
18
src/lemon.c
18
src/lemon.c
|
@ -52,8 +52,7 @@ extern char *getenv();
|
|||
#define MAXRHS 1000
|
||||
#endif
|
||||
|
||||
char *msort();
|
||||
extern void *malloc();
|
||||
void *msort(void *list, void **next, int(*cmp)(void *, void *));
|
||||
|
||||
extern void memory_error() NORETURN;
|
||||
|
||||
|
@ -98,8 +97,8 @@ struct s_options {
|
|||
enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR,
|
||||
OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type;
|
||||
char *label;
|
||||
char *arg;
|
||||
char *message;
|
||||
void *arg;
|
||||
const char *message;
|
||||
};
|
||||
int OptInit(/* char**,struct s_options*,FILE* */);
|
||||
int OptNArgs(/* void */);
|
||||
|
@ -395,7 +394,7 @@ struct action *ap2;
|
|||
struct action *Action_sort(ap)
|
||||
struct action *ap;
|
||||
{
|
||||
ap = (struct action *)msort(ap,&ap->next,actioncmp);
|
||||
ap = (struct action *)msort(ap,(void **)&ap->next,actioncmp);
|
||||
return ap;
|
||||
}
|
||||
|
||||
|
@ -1219,14 +1218,14 @@ struct lemon *lemp;
|
|||
|
||||
/* Sort the configuration list */
|
||||
void Configlist_sort(){
|
||||
current = (struct config *)msort(current,&(current->next),Configcmp);
|
||||
current = (struct config *)msort(current,(void **)&(current->next),Configcmp);
|
||||
currentend = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Sort the basis configuration list */
|
||||
void Configlist_sortbasis(){
|
||||
basis = (struct config *)msort(current,&(current->bp),Configcmp);
|
||||
basis = (struct config *)msort(current,(void **)&(current->bp),Configcmp);
|
||||
basisend = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -1580,10 +1579,7 @@ int offset;
|
|||
** The "next" pointers for elements in list are changed.
|
||||
*/
|
||||
#define LISTSIZE 30
|
||||
char *msort(list,next,cmp)
|
||||
char *list;
|
||||
char **next;
|
||||
int (*cmp)();
|
||||
void *msort(void *list, void **next, int(*cmp)(void *, void *))
|
||||
{
|
||||
unsigned long offset;
|
||||
char *ep;
|
||||
|
|
Loading…
Reference in New Issue