Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Move setlocale(3) and the wchar stubs over to .cpp.
Browse files Browse the repository at this point in the history
Also separate out the C++ files so we can use -Werror on them. I'd
rather wait for LOCAL_CPPFLAGS to be in AOSP, but this also lets us
see which files still need to be sorted into one bucket or the other.

Change-Id: I6acc1f7c043935c70a3b089f705d218b9aaaba0a
  • Loading branch information
enh-google committed Oct 23, 2012
1 parent 5a9911e commit 29c7f0b
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 362 deletions.
75 changes: 47 additions & 28 deletions libc/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,12 @@ libc_common_src_files := \
bionic/eventfd.c \
bionic/fcntl.c \
bionic/fdprintf.c \
bionic/__fgets_chk.cpp \
bionic/flockfile.c \
bionic/fork.c \
bionic/fstatfs.c \
bionic/ftime.c \
bionic/ftok.c \
bionic/fts.c \
bionic/getcwd.cpp \
bionic/getdtablesize.c \
bionic/gethostname.c \
bionic/getpgrp.c \
Expand All @@ -199,18 +197,14 @@ libc_common_src_files := \
bionic/issetugid.c \
bionic/ldexp.c \
bionic/libc_init_common.c \
bionic/locale.c \
bionic/logd_write.c \
bionic/lseek64.c \
bionic/md5.c \
bionic/memccpy.c \
bionic/memchr.c \
bionic/__memcpy_chk.cpp \
bionic/memmem.c \
bionic/__memmove_chk.cpp \
bionic/memmove_words.c \
bionic/memrchr.c \
bionic/__memset_chk.cpp \
bionic/memswap.c \
bionic/mmap.c \
bionic/openat.c \
Expand Down Expand Up @@ -253,40 +247,24 @@ libc_common_src_files := \
bionic/sigwait.c \
bionic/sleep.c \
bionic/statfs.c \
bionic/__strcat_chk.cpp \
bionic/strcoll.c \
bionic/__strcpy_chk.cpp \
bionic/strerror.cpp \
bionic/strerror_r.cpp \
bionic/__strlcat_chk.cpp \
bionic/__strlcpy_chk.cpp \
bionic/__strlen_chk.cpp \
bionic/__strncat_chk.cpp \
bionic/__strncpy_chk.cpp \
bionic/strndup.c \
bionic/strnlen.c \
bionic/strntoimax.c \
bionic/strntoumax.c \
bionic/strsignal.cpp \
bionic/strtotimeval.c \
bionic/stubs.cpp \
bionic/system_properties.c \
bionic/tcgetpgrp.c \
bionic/tcsetpgrp.c \
bionic/tdestroy.c \
bionic/thread_atexit.c \
bionic/time64.c \
bionic/tmpfile.cpp \
bionic/__umask_chk.cpp \
bionic/umount.c \
bionic/unlockpt.c \
bionic/usleep.c \
bionic/utime.c \
bionic/utmp.c \
bionic/__vsnprintf_chk.cpp \
bionic/__vsprintf_chk.cpp \
bionic/wait.c \
bionic/wchar.c \
bionic/wcscoll.c \
netbsd/gethnamaddr.c \
netbsd/isc/ev_timers.c \
Expand Down Expand Up @@ -319,6 +297,30 @@ libc_common_src_files := \
netbsd/nameser/ns_print.c \
netbsd/nameser/ns_samedomain.c \

libc_bionic_src_files := \
bionic/__fgets_chk.cpp \
bionic/getcwd.cpp \
bionic/__memcpy_chk.cpp \
bionic/__memmove_chk.cpp \
bionic/__memset_chk.cpp \
bionic/setlocale.cpp \
bionic/__strcat_chk.cpp \
bionic/__strcpy_chk.cpp \
bionic/strerror.cpp \
bionic/strerror_r.cpp \
bionic/__strlcat_chk.cpp \
bionic/__strlcpy_chk.cpp \
bionic/__strlen_chk.cpp \
bionic/__strncat_chk.cpp \
bionic/__strncpy_chk.cpp \
bionic/strsignal.cpp \
bionic/stubs.cpp \
bionic/tmpfile.cpp \
bionic/__umask_chk.cpp \
bionic/__vsnprintf_chk.cpp \
bionic/__vsprintf_chk.cpp \
bionic/wchar.cpp \

libc_upstream_netbsd_src_files := \
upstream-netbsd/libc/compat-43/creat.c \
upstream-netbsd/libc/gen/ftw.c \
Expand Down Expand Up @@ -509,7 +511,6 @@ libc_common_cflags := \
-I$(LOCAL_PATH)/private \
-DPOSIX_MISTAKE \
-DLOG_ON_HEAP_ERROR \
-std=gnu99 \
-Wall -Wextra

# these macro definitions are required to implement the
Expand Down Expand Up @@ -772,18 +773,34 @@ LOCAL_SYSTEM_SHARED_LIBRARIES :=
include $(BUILD_STATIC_LIBRARY)


# ========================================================
# libc_bionic.a - home-grown C library code
# ========================================================
#
include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(libc_bionic_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) -Werror
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_bionic
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_SYSTEM_SHARED_LIBRARIES :=

include $(BUILD_STATIC_LIBRARY)


# ========================================================
# libc_common.a
# ========================================================

include $(CLEAR_VARS)

LOCAL_SRC_FILES := $(libc_common_src_files)
LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_common
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_netbsd
LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_netbsd
LOCAL_SYSTEM_SHARED_LIBRARIES :=

include $(BUILD_STATIC_LIBRARY)
Expand All @@ -808,7 +825,8 @@ LOCAL_SRC_FILES := \

LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_CFLAGS := $(libc_common_cflags) \
-DLIBC_STATIC
-DLIBC_STATIC \
-std=gnu99

LOCAL_MODULE := libc_nomalloc
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Expand All @@ -831,7 +849,8 @@ LOCAL_SRC_FILES := \
bionic/libc_init_static.c

LOCAL_CFLAGS := $(libc_common_cflags) \
-DLIBC_STATIC
-DLIBC_STATIC \
-std=gnu99
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Expand All @@ -852,7 +871,7 @@ include $(CLEAR_VARS)
# Since this code is experimental it is disabled by default.
# see libc/bionic/pthread_debug.c for details

LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99 -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
LOCAL_C_INCLUDES := $(libc_common_c_includes)

LOCAL_SRC_FILES := \
Expand Down
9 changes: 5 additions & 4 deletions libc/bionic/locale.c → libc/bionic/setlocale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

#include <locale.h>
#include <stdlib.h>

char* setlocale (int category, char const *locale)
{
/* INTENTIONAL: there is no locale support in Bionic */
return 0;
// setlocale(3) always fails on bionic.
char* setlocale(int /*category*/, char const* /*locale*/) {
return NULL;
}
Loading

0 comments on commit 29c7f0b

Please sign in to comment.