[klibc] [PATCH] Fix up 3 klibc build warnings.
Maciej Żenczykowski
maze at google.com
Tue Oct 19 14:11:16 PDT 2010
klibc/scripts/basic/fixdep.c: In function 'traps':
klibc/scripts/basic/fixdep.c:368: warning: dereferencing type-punned pointer will break strict-aliasing rules
klibc/scripts/basic/fixdep.c:370: warning: dereferencing type-punned pointer will break strict-aliasing rules
klibc/usr/dash/jobs.c: In function 'sprint_status':
klibc/usr/dash/jobs.c:427: warning: format not a string literal and no format arguments
klibc/usr/dash/trap.c: In function 'exitshell':
klibc/usr/dash/trap.c:354: warning: variable 'status' might be clobbered by 'longjmp' or 'vfork'
Signed-off-by: Maciej Żenczykowski <maze at google.com>
---
scripts/basic/fixdep.c | 9 ++++++---
usr/dash/jobs.c | 2 +-
usr/dash/trap.c | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 0b61bea..cf72251 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -363,11 +363,14 @@ void print_deps(void)
void traps(void)
{
- static char test[] __attribute__((aligned(sizeof(int)))) = "CONF";
+ union {
+ int i;
+ char c[4];
+ } test = { .c = "CONF" };
- if (*(int *)test != INT_CONF) {
+ if (test.i != INT_CONF) {
fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
- *(int *)test);
+ test.i);
exit(2);
}
}
diff --git a/usr/dash/jobs.c b/usr/dash/jobs.c
index bf770dd..43b6b98 100644
--- a/usr/dash/jobs.c
+++ b/usr/dash/jobs.c
@@ -424,7 +424,7 @@ sprint_status(char *s, int status, int sigonly)
goto out;
#endif
}
- col = fmtstr(s, 32, strsignal(st));
+ col = fmtstr(s, 32, "%s", strsignal(st));
if (WCOREDUMP(status)) {
col += fmtstr(s + col, 16, " (core dumped)");
}
diff --git a/usr/dash/trap.c b/usr/dash/trap.c
index 18c3cd1..d6706c6 100644
--- a/usr/dash/trap.c
+++ b/usr/dash/trap.c
@@ -351,7 +351,7 @@ exitshell(void)
{
struct jmploc loc;
char *p;
- int status;
+ volatile int status;
#ifdef HETIO
hetio_reset_term();
--
1.7.1
More information about the klibc
mailing list