From 6b5585f9aa5e0c346474c444ea6ee9a1ab22cd0b Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 11 Nov 2011 13:01:40 +0800 Subject: [PATCH] Kernel - Disabled -fno-builtins, removed some unneeded memcpy calls --- Kernel/Makefile | 2 +- Kernel/vfs/open.c | 10 ++++------ Modules/IPStack/routing.c | 4 ++-- Modules/Makefile.tpl | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Kernel/Makefile b/Kernel/Makefile index 0dee58d0..93ad6b60 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -21,7 +21,7 @@ MAKEDEP = $(CC) -M CPPFLAGS += -I./include -I./arch/$(ARCHDIR)/include -D_MODULE_NAME_=\"Kernel\" CPPFLAGS += -DARCH=$(ARCH) -DARCHDIR=$(ARCHDIR) -DARCHDIR_IS_$(ARCHDIR)=1 CPPFLAGS += -DKERNEL_VERSION=$(KERNEL_VERSION) -CFLAGS += -Wall -Werror -fno-stack-protector -fno-builtin -Wstrict-prototypes -g +CFLAGS += -Wall -Werror -fno-stack-protector -Wstrict-prototypes -g CFLAGS += -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized LDFLAGS += -T arch/$(ARCHDIR)/link.ld -g diff --git a/Kernel/vfs/open.c b/Kernel/vfs/open.c index 1845b7a4..340c9b26 100644 --- a/Kernel/vfs/open.c +++ b/Kernel/vfs/open.c @@ -55,12 +55,9 @@ char *VFS_GetAbsPath(const char *Path) } // - Fetch ChRoot - if( chroot == NULL ) { + if( chroot == NULL ) chroot = ""; - chrootLen = 0; - } else { - chrootLen = strlen(chroot); - } + chrootLen = strlen(chroot); // Check if the path is already absolute if(Path[0] == '/') { @@ -155,7 +152,8 @@ char *VFS_GetAbsPath(const char *Path) ret[iPos2] = 0; // Prepend the chroot - memcpy( ret, chroot, chrootLen ); + if(chrootLen) + memcpy( ret, chroot, chrootLen ); LEAVE('s', ret); // Log_Debug("VFS", "VFS_GetAbsPath: RETURN '%s'", ret); diff --git a/Modules/IPStack/routing.c b/Modules/IPStack/routing.c index 9e298a0e..1cde444f 100644 --- a/Modules/IPStack/routing.c +++ b/Modules/IPStack/routing.c @@ -56,9 +56,9 @@ char *IPStack_RouteDir_ReadDir(tVFS_Node *Node, int Pos) } { - int len = sprintf(NULL, "%i", rt->Node.Inode); + int len = sprintf(NULL, "%i", (int)rt->Node.Inode); char buf[len+1]; - sprintf(buf, "%i", rt->Node.Inode); + sprintf(buf, "%i", (int)rt->Node.Inode); return strdup(buf); } } diff --git a/Modules/Makefile.tpl b/Modules/Makefile.tpl index b31943e6..04a0c041 100644 --- a/Modules/Makefile.tpl +++ b/Modules/Makefile.tpl @@ -13,7 +13,7 @@ CPPFLAGS := -I$(ACESSDIR)/Kernel/include -I$(ACESSDIR)/Kernel/arch/$(ARCHDIR)/in CPPFLAGS += -DARCH=$(ARCH) -DARCH_is_$(ARCH) -DARCHDIR_is_$(ARCHDIR) CPPFLAGS += $(_CPPFLAGS) CPPFLAGS += $(LIBINCLUDES) -CFLAGS := -std=gnu99 -Wall -Werror -fno-stack-protector -g -O3 -fno-builtin +CFLAGS := -std=gnu99 -Wall -Werror -fno-stack-protector -g -O3 ifneq ($(CATEGORY),) FULLNAME := $(CATEGORY)_$(NAME) -- 2.20.1