summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/lib/bootz.c8
-rw-r--r--arch/blackfin/Makefile2
-rw-r--r--arch/ppc/Makefile2
-rw-r--r--arch/sandbox/Makefile1
-rw-r--r--arch/sandbox/os/Makefile1
-rw-r--r--arch/x86/Makefile2
-rw-r--r--fs/fs.c18
-rw-r--r--include/stdio.h12
-rw-r--r--scripts/Makefile.build2
-rw-r--r--scripts/mod/modpost.c2
-rw-r--r--scripts/mod/modpost.h2
13 files changed, 30 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 5d57d1c724..18b6e59630 100644
--- a/Makefile
+++ b/Makefile
@@ -825,7 +825,7 @@ prepare prepare-all: prepare0
# Leave this as default for preprocessing barebox.lds.S, which is now
# done in arch/$(ARCH)/kernel/Makefile
-export CPPFLAGS_barebox.lds += -P -C -U$(ARCH)
+export CPPFLAGS_barebox.lds += -C -U$(ARCH)
# FIXME: The asm symlink changes when $(ARCH) changes. That's
# hard to detect, but I suppose "make mrproper" is a good idea
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index d25412d11f..0c42f3d1ea 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -121,7 +121,7 @@ endif
TEXT_BASE = $(CONFIG_TEXT_BASE)
-CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
+CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
ifndef CONFIG_MODULES
# Add cleanup flags
diff --git a/arch/arm/lib/bootz.c b/arch/arm/lib/bootz.c
index fc14487bfa..956ea82862 100644
--- a/arch/arm/lib/bootz.c
+++ b/arch/arm/lib/bootz.c
@@ -53,7 +53,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
if (!usemap) {
header = &__header;
- ret = read(fd, header, sizeof(header));
+ ret = read(fd, header, sizeof(*header));
if (ret < sizeof(*header)) {
printf("could not read %s\n", argv[1]);
goto err_out;
@@ -89,10 +89,10 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[])
}
}
- memcpy(zimage, &header, sizeof(header));
+ memcpy(zimage, header, sizeof(*header));
- ret = read(fd, zimage + sizeof(header), end - sizeof(header));
- if (ret < end - sizeof(header)) {
+ ret = read(fd, zimage + sizeof(*header), end - sizeof(*header));
+ if (ret < end - sizeof(*header)) {
printf("could not read %s\n", argv[1]);
goto err_out1;
}
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 902268da70..a0b87f77d7 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -7,7 +7,7 @@ cpu-$(CONFIG_BF561) := bf561
TEXT_BASE = $(CONFIG_TEXT_BASE)
-CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
+CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
CFLAGS += -D__blackfin__
# -Ttext $(TEXT_BASE)
KALLSYMS += --symbol-prefix=_
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 46d64e5bc6..c7bf863747 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -14,7 +14,7 @@ cpu-$(CONFIG_ARCH_MPC5200) := mpc5xxx
TEXT_BASE = $(CONFIG_TEXT_BASE)
-CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -P
+CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
# Add cleanup flags
ifndef CONFIG_MODULES
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index ed1194c3e6..b88f1f60f8 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -10,7 +10,6 @@ lds-y := $(BOARD)/barebox.lds
TEXT_BASE = $(CONFIG_TEXT_BASE)
-CPPFLAGS += -P
CFLAGS += -Dmalloc=barebox_malloc \
-Dfree=barebox_free -Drealloc=barebox_realloc \
-Dread=barebox_read -Dwrite=barebox_write \
diff --git a/arch/sandbox/os/Makefile b/arch/sandbox/os/Makefile
index 2980301e15..dc211d94cd 100644
--- a/arch/sandbox/os/Makefile
+++ b/arch/sandbox/os/Makefile
@@ -8,7 +8,6 @@ else
CPPFLAGS = $(patsubst %,-I$(srctree)/%include,$(machdirs))
endif
-CPPFLAGS += -P
CFLAGS := -Wall
NOSTDINC_FLAGS :=
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 3b034c0516..db4180b32b 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -5,7 +5,7 @@ machine-y := i386
TEXT_BASE = $(CONFIG_TEXT_BASE)
-CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE) -P
+CPPFLAGS += -march=i386 -m32 -DTEXT_BASE=$(TEXT_BASE)
LDFLAGS += -m elf_i386
ifndef CONFIG_MODULES
diff --git a/fs/fs.c b/fs/fs.c
index 7d65ec819b..51a7411b69 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -293,9 +293,13 @@ static int path_check_prereq(const char *path, unsigned int flags)
struct stat s;
unsigned int m;
+ errno = 0;
+
if (stat(path, &s)) {
- if (flags & S_UB_DOES_NOT_EXIST)
- return 0;
+ if (flags & S_UB_DOES_NOT_EXIST) {
+ errno = 0;
+ goto out;
+ }
errno = -ENOENT;
goto out;
}
@@ -305,8 +309,10 @@ static int path_check_prereq(const char *path, unsigned int flags)
goto out;
}
- if (flags == S_UB_EXISTS)
- return 0;
+ if (flags == S_UB_EXISTS) {
+ errno = 0;
+ goto out;
+ }
m = s.st_mode;
@@ -325,7 +331,6 @@ static int path_check_prereq(const char *path, unsigned int flags)
goto out;
}
- errno = 0;
out:
return errno;
}
@@ -346,8 +351,9 @@ int chdir(const char *pathname)
strcpy(cwd, p);
- free(p);
out:
+ free(p);
+
return errno;
}
EXPORT_SYMBOL(chdir);
diff --git a/include/stdio.h b/include/stdio.h
index c824764689..a0d81d3b74 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -9,7 +9,7 @@
*/
/* serial stuff */
-void serial_printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
+void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
/* stdin */
int tstc(void);
@@ -30,12 +30,12 @@ static inline void putchar(char c)
console_putc(CONSOLE_STDOUT, c);
}
-int printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
+int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
int vprintf(const char *fmt, va_list args);
-int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
-int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(printf, 3, 4)));
+int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
+int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4)));
int vsprintf(char *buf, const char *fmt, va_list args);
-char *asprintf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
+char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
char *vasprintf(const char *fmt, va_list ap);
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
@@ -54,7 +54,7 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
#define stderr 2
#define MAX_FILES 128
-void fprintf(int file, const char *fmt, ...) __attribute__ ((format(printf, 2, 3)));
+void fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
int fputs(int file, const char *s);
int fputc(int file, const char c);
int ftstc(int file);
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index c2bab5cb13..f70e2b946d 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -244,7 +244,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(always)
# Linker scripts preprocessor (.lds.S -> .lds)
# ---------------------------------------------------------------------------
quiet_cmd_cpp_lds_S = LDS $@
- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $<
+ cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -D__ASSEMBLY__ -o $@ $<
%.lds: %.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 08b75b67f1..e99448602c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1300,7 +1300,7 @@ static void read_symbols(char *modname)
* following helper, then compare to the file on disk and
* only update the later if anything changed */
-void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf,
+void __attribute__((format(__printf__, 2, 3))) buf_printf(struct buffer *buf,
const char *fmt, ...)
{
char tmp[SZ];
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 4156dd34c5..0c23259836 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -94,7 +94,7 @@ struct buffer {
int size;
};
-void __attribute__((format(printf, 2, 3)))
+void __attribute__((format(__printf__, 2, 3)))
buf_printf(struct buffer *buf, const char *fmt, ...);
void