From 3d40c99b3dd79616147d2adde156486e5570b555 Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 7 Feb 2011 09:52:44 +0000 Subject: [PATCH] Commented out redefining printf, because it generates lot of warnings in system headers --- project/jni/application/Android.mk | 2 +- project/jni/application/setEnvironment-r4b.sh | 2 +- project/jni/application/setEnvironment-r5b.sh | 2 +- .../jni/sdl-1.2/include/SDL_android_printf.h | 1 + .../jni/sdl-1.3/include/SDL_android_printf.h | 47 +++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) create mode 120000 project/jni/sdl-1.2/include/SDL_android_printf.h create mode 100644 project/jni/sdl-1.3/include/SDL_android_printf.h diff --git a/project/jni/application/Android.mk b/project/jni/application/Android.mk index 3e68f99c5..48dab2b67 100644 --- a/project/jni/application/Android.mk +++ b/project/jni/application/Android.mk @@ -25,7 +25,7 @@ LOCAL_C_INCLUDES += $(foreach D, $(APP_SUBDIRS), $(LOCAL_PATH)/$(D)) \ $(LOCAL_PATH)/../sdl-$(SDL_VERSION)/include \ $(foreach L, $(COMPILED_LIBRARIES), $(LOCAL_PATH)/../$(L)/include) -LOCAL_CFLAGS += -D__sF=__SDL_fake_stdout -Dcout=__SDL_fake_cout -Dcerr=__SDL_fake_cerr -Dclog=__SDL_fake_clog -Dprintf=__SDL_android_printf +LOCAL_CFLAGS += -include SDL_android_printf.h LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS) diff --git a/project/jni/application/setEnvironment-r4b.sh b/project/jni/application/setEnvironment-r4b.sh index 1def20665..f5ed3aaba 100755 --- a/project/jni/application/setEnvironment-r4b.sh +++ b/project/jni/application/setEnvironment-r4b.sh @@ -48,7 +48,7 @@ CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -O2 \ -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \ -Wa,--noexecstack -DNDEBUG -g \ --D__sF=__SDL_fake_stdout -Dcout=__SDL_fake_cout -Dcerr=__SDL_fake_cerr -Dclog=__SDL_fake_clog -Dprintf=__SDL_android_printf \ +-include SDL_android_printf.h \ -I$LOCAL_PATH/../sdl-1.2/include $STL_INCLUDE \ `echo $APP_MODULES | sed \"s@\([-a-zA-Z0-9_.]\+\)@-I$LOCAL_PATH/../\1/include@g\"`" diff --git a/project/jni/application/setEnvironment-r5b.sh b/project/jni/application/setEnvironment-r5b.sh index efea1c689..b566da38f 100755 --- a/project/jni/application/setEnvironment-r5b.sh +++ b/project/jni/application/setEnvironment-r5b.sh @@ -50,7 +50,7 @@ CFLAGS="\ -fpic -ffunction-sections -funwind-tables -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi \ -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \ -I$NDK/platforms/$PLATFORMVER/arch-arm/usr/include -Wa,--noexecstack \ --DANDROID -D__sF=__SDL_fake_stdout -Dcout=__SDL_fake_cout -Dcerr=__SDL_fake_cerr -Dclog=__SDL_fake_clog -Dprintf=__SDL_android_printf \ +-DANDROID -include SDL_android_printf.h \ -DNDEBUG -O2 -g \ -I$NDK/sources/cxx-stl/gnu-libstdc++/include \ -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include \ diff --git a/project/jni/sdl-1.2/include/SDL_android_printf.h b/project/jni/sdl-1.2/include/SDL_android_printf.h new file mode 120000 index 000000000..8c51f2d72 --- /dev/null +++ b/project/jni/sdl-1.2/include/SDL_android_printf.h @@ -0,0 +1 @@ +../../sdl-1.3/include/SDL_android_printf.h \ No newline at end of file diff --git a/project/jni/sdl-1.3/include/SDL_android_printf.h b/project/jni/sdl-1.3/include/SDL_android_printf.h new file mode 100644 index 000000000..0d0fd34a9 --- /dev/null +++ b/project/jni/sdl-1.3/include/SDL_android_printf.h @@ -0,0 +1,47 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +#ifndef __SDL_android_printf_h +#define __SDL_android_printf_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* Outputs to logcat */ +extern int __SDL_android_printf(const char * fmt, ...) __attribute__((format(printf, 1, 2))); + +#define __sF __SDL_fake_stdout + +/* Generates lot of warning messages in standard headers, enable only for ultra debug mode */ +/* +#define printf __SDL_android_printf +*/ + +#ifdef __cplusplus +#define cout __SDL_fake_cout +#define cerr __SDL_fake_cerr +#define clog __SDL_fake_clog +} +#endif + +#endif