summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-06 18:17:12 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-01 14:34:58 -0800
commitce3d4de40fa89b2b209ab19acd763eec83bc70f1 (patch)
tree5ebb57db3c20c69aed8a6ccf48f63bf7734a07c3
parent84f5fee3c769fc907c561110f4828416f921e81a (diff)
Stop casting _parse_data pointers through (char *) and back
Eliminates clang warnings: cppsetup.c:41:30: warning: cast from 'char *' to 'struct _parse_data *' increases required alignment from 1 to 8 [-Wcast-align] struct _parse_data *pd = (struct _parse_data *) ip->data; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cppsetup.c:69:30: warning: cast from 'char *' to 'struct _parse_data *' increases required alignment from 1 to 8 [-Wcast-align] struct _parse_data *pd = (struct _parse_data *) ip->data; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--cppsetup.c6
-rw-r--r--ifparser.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/cppsetup.c b/cppsetup.c
index d697730..e0fe51b 100644
--- a/cppsetup.c
+++ b/cppsetup.c
@@ -38,7 +38,7 @@ struct _parse_data {
static const char *
my_if_errors(IfParser *ip, const char *cp, const char *expecting)
{
- struct _parse_data *pd = (struct _parse_data *) ip->data;
+ struct _parse_data *pd = ip->data;
long lineno = pd->filep->f_line;
const char *filename = pd->filename;
char prefix[300];
@@ -66,7 +66,7 @@ static struct symtab **
lookup_variable(IfParser *ip, const char *var, int len)
{
char tmpbuf[MAXNAMELEN + 1];
- struct _parse_data *pd = (struct _parse_data *) ip->data;
+ struct _parse_data *pd = ip->data;
if (len > MAXNAMELEN)
return NULL;
@@ -125,7 +125,7 @@ cppsetup(const char *filename, const char *line,
ip.funcs.handle_error = my_if_errors;
ip.funcs.eval_defined = my_eval_defined;
ip.funcs.eval_variable = my_eval_variable;
- ip.data = (char *) &pd;
+ ip.data = &pd;
(void) ParseIfExpression(&ip, line, &val);
if (val)
diff --git a/ifparser.h b/ifparser.h
index 5d88d05..cbc7909 100644
--- a/ifparser.h
+++ b/ifparser.h
@@ -70,7 +70,7 @@ typedef struct _if_parser {
long (*eval_variable)(struct _if_parser *, const char *, int);
int (*eval_defined)(struct _if_parser *, const char *, int);
} funcs;
- char *data;
+ struct _parse_data *data;
} IfParser;
const char *ParseIfExpression(IfParser *, const char *, long *);