source: clfs-embedded/patches/gcc-4.1.1-uclibc-1.patch@ 82b88f2

Last change on this file since 82b88f2 was 841271e, checked in by Jim Gifford <clfs@…>, 18 years ago

uClibc updates

  • Property mode set to 100644
File size: 138.3 KB
  • boehm-gc/configure

    Submitted By: Jim Gifford (patches at jg555 dot com)
    Date: 2006-11-13
    Initial Package Version: 4.1.1
    Origin: uClibc and Buildroot
    Upstream Status: uClibc Specific
    Description: Makes GCC uClibc Friendly
    
    diff -Naur gcc-4.1.1.orig/boehm-gc/configure gcc-4.1.1/boehm-gc/configure
    old new  
    43204320  lt_cv_deplibs_check_method=pass_all
    43214321  ;;
    43224322
     4323linux-uclibc*)
     4324  lt_cv_deplibs_check_method=pass_all
     4325  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     4326  ;;
     4327
    43234328netbsd* | knetbsd*-gnu)
    43244329  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    43254330    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  • boehm-gc/include/gc.h

    diff -Naur gcc-4.1.1.orig/boehm-gc/include/gc.h gcc-4.1.1/boehm-gc/include/gc.h
    old new  
    500500#ifdef __linux__
    501501# include <features.h>
    502502# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
    503      && !defined(__ia64__)
     503     && !defined(__ia64__) && !defined(__UCLIBC__)
    504504#   ifndef GC_HAVE_BUILTIN_BACKTRACE
    505505#     define GC_HAVE_BUILTIN_BACKTRACE
    506506#   endif
  • configure

    diff -Naur gcc-4.1.1.orig/configure gcc-4.1.1/configure
    old new  
    11331133    ;;
    11341134"")
    11351135    case "${target}" in
    1136     *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
     1136    *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
    11371137        # Enable libmudflap by default in GNU and friends.
    11381138        ;;
    11391139    *-*-freebsd*)
  • configure.in

    diff -Naur gcc-4.1.1.orig/configure.in gcc-4.1.1/configure.in
    old new  
    341341    ;;
    342342"")
    343343    case "${target}" in
    344     *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
     344    *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
    345345        # Enable libmudflap by default in GNU and friends.
    346346        ;;
    347347    *-*-freebsd*)
  • contrib/regression/objs-gcc.sh

    diff -Naur gcc-4.1.1.orig/contrib/regression/objs-gcc.sh gcc-4.1.1/contrib/regression/objs-gcc.sh
    old new  
    105105 then
    106106  make all-gdb all-dejagnu all-ld || exit 1
    107107  make install-gdb install-dejagnu install-ld || exit 1
     108elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
     109 then
     110  make all-gdb all-dejagnu all-ld || exit 1
     111  make install-gdb install-dejagnu install-ld || exit 1
    108112elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
    109113  make bootstrap || exit 1
    110114  make install || exit 1
  • gcc/config/alpha/linux-elf.h

    diff -Naur gcc-4.1.1.orig/gcc/config/alpha/linux-elf.h gcc-4.1.1/gcc/config/alpha/linux-elf.h
    old new  
    2727#define SUBTARGET_EXTRA_SPECS \
    2828{ "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
    2929
     30#if defined USE_UCLIBC
     31#define ELF_DYNAMIC_LINKER      "/lib/ld-uClibc.so.0"
     32#else
    3033#define ELF_DYNAMIC_LINKER      "/lib/ld-linux.so.2"
     34#endif
    3135
    3236#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}          \
    3337  %{O*:-O3} %{!O*:-O1}                                          \
  • gcc/config/arm/linux-eabi.h

    diff -Naur gcc-4.1.1.orig/gcc/config/arm/linux-eabi.h gcc-4.1.1/gcc/config/arm/linux-eabi.h
    old new  
    5353/* Use ld-linux.so.3 so that it will be possible to run "classic"
    5454   GNU/Linux binaries on an EABI system.  */
    5555#undef LINUX_TARGET_INTERPRETER
     56#ifdef USE_UCLIBC
     57#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
     58#else
    5659#define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3"
     60#endif
    5761
    5862/* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
    5963   use the GNU/Linux version, not the generic BPABI version.  */
  • gcc/config/arm/linux-elf.h

    diff -Naur gcc-4.1.1.orig/gcc/config/arm/linux-elf.h gcc-4.1.1/gcc/config/arm/linux-elf.h
    old new  
    2828#undef  TARGET_VERSION
    2929#define TARGET_VERSION  fputs (" (ARM GNU/Linux with ELF)", stderr);
    3030
     31/*
     32 * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
     33 * (big endian) configurations.
     34 */
     35#if TARGET_BIG_ENDIAN_DEFAULT
     36#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
     37#define TARGET_ENDIAN_OPTION "mbig-endian"
     38#define TARGET_LINKER_EMULATION "armelfb_linux"
     39#else
     40#define TARGET_ENDIAN_DEFAULT 0
     41#define TARGET_ENDIAN_OPTION "mlittle-endian"
     42#define TARGET_LINKER_EMULATION "armelf_linux"
     43#endif
     44
    3145#undef  TARGET_DEFAULT_FLOAT_ABI
    3246#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
    3347
    3448#undef  TARGET_DEFAULT
    35 #define TARGET_DEFAULT (0)
     49#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
    3650
    3751#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
    3852
    39 #define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
     53#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
    4054
    4155#undef  MULTILIB_DEFAULTS
    4256#define MULTILIB_DEFAULTS \
    43         { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
     57        { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
    4458
    4559/* Now we define the strings used to build the spec file.  */
    4660#undef  LIB_SPEC
     
    5165
    5266#define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
    5367
     68#ifdef USE_UCLIBC
     69#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
     70#else
    5471#define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2"
     72#endif
    5573
    5674#define LINUX_TARGET_LINK_SPEC  "%{h*} %{version:-v} \
    5775   %{b} \
     
    6179   %{rdynamic:-export-dynamic} \
    6280   %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
    6381   -X \
    64    %{mbig-endian:-EB}" \
     82   %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
    6583   SUBTARGET_EXTRA_LINK_SPEC
    6684
    6785#undef  LINK_SPEC
  • gcc/config/cris/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/cris/linux.h gcc-4.1.1/gcc/config/cris/linux.h
    old new  
    7373#undef CRIS_DEFAULT_CPU_VERSION
    7474#define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
    7575
     76#ifdef USE_UCLIBC
     77
     78#undef CRIS_SUBTARGET_VERSION
     79#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
     80
     81#undef CRIS_LINK_SUBTARGET_SPEC
     82#define CRIS_LINK_SUBTARGET_SPEC \
     83 "-mcrislinux\
     84  -rpath-link include/asm/../..%s\
     85  %{shared} %{static}\
     86  %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
     87  %{!shared: \
     88    %{!static: \
     89      %{rdynamic:-export-dynamic} \
     90      %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
     91  %{!r:%{O2|O3: --gc-sections}}"
     92
     93#else  /* USE_UCLIBC */
     94
    7695#undef CRIS_SUBTARGET_VERSION
    7796#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
    7897
     
    87106  %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
    88107  %{!r:%{O2|O3: --gc-sections}}"
    89108
     109#endif  /* USE_UCLIBC */
     110
    90111
    91112/* Node: Run-time Target */
    92113
  • gcc/config/i386/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/i386/linux.h gcc-4.1.1/gcc/config/i386/linux.h
    old new  
    107107#define LINK_EMULATION "elf_i386"
    108108#define DYNAMIC_LINKER "/lib/ld-linux.so.2"
    109109
     110#if defined USE_UCLIBC
     111#undef DYNAMIC_LINKER
     112#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     113#endif
     114
    110115#undef  SUBTARGET_EXTRA_SPECS
    111116#define SUBTARGET_EXTRA_SPECS \
    112117  { "link_emulation", LINK_EMULATION },\
  • gcc/config/i386/linux64.h

    diff -Naur gcc-4.1.1.orig/gcc/config/i386/linux64.h gcc-4.1.1/gcc/config/i386/linux64.h
    old new  
    5454   When the -shared link option is used a final link is not being
    5555   done.  */
    5656
     57#ifdef USE_UCLIBC
     58#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     59#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
     60#else
     61#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
     62#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
     63#endif
    5764#undef  LINK_SPEC
    5865#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
    5966  %{shared:-shared} \
    6067  %{!shared: \
    6168    %{!static: \
    6269      %{rdynamic:-export-dynamic} \
    63       %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
    64       %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
     70      %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
     71      %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
    6572    %{static:-static}}"
    6673
    6774/* Similar to standard Linux, but adding -ffast-math support.  */
  • gcc/config/ia64/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/ia64/linux.h gcc-4.1.1/gcc/config/ia64/linux.h
    old new  
    3737/* Define this for shared library support because it isn't in the main
    3838   linux.h file.  */
    3939
     40#ifdef USE_UCLIBC
     41#define ELF_DYNAMIC_LINKER      "/lib/ld-uClibc.so.0"
     42#else
     43#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
     44#endif
    4045#undef LINK_SPEC
    4146#define LINK_SPEC "\
    4247  %{shared:-shared} \
    4348  %{!shared: \
    4449    %{!static: \
    4550      %{rdynamic:-export-dynamic} \
    46       %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
     51      %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
    4752      %{static:-static}}"
    4853
    4954
  • gcc/config/m68k/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/m68k/linux.h gcc-4.1.1/gcc/config/m68k/linux.h
    old new  
    123123
    124124/* If ELF is the default format, we should not use /lib/elf.  */
    125125
     126#ifdef USE_UCLIBC
     127#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     128#else
     129#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
     130#endif
    126131#undef  LINK_SPEC
    127132#define LINK_SPEC "-m m68kelf %{shared} \
    128133  %{!shared: \
    129134    %{!static: \
    130135      %{rdynamic:-export-dynamic} \
    131       %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
     136      %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
    132137    %{static}}"
    133138
    134139/* For compatibility with linux/a.out */
  • gcc/config/mips/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/mips/linux.h gcc-4.1.1/gcc/config/mips/linux.h
    old new  
    105105
    106106/* Borrowed from sparc/linux.h */
    107107#undef LINK_SPEC
     108#ifdef USE_UCLIBC
     109#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     110#else
     111#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
     112#endif
    108113#define LINK_SPEC \
    109114 "%(endian_spec) \
    110115  %{shared:-shared} \
     
    112117    %{!ibcs: \
    113118      %{!static: \
    114119        %{rdynamic:-export-dynamic} \
    115         %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
     120        %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
    116121        %{static:-static}}}"
    117122
    118123#undef SUBTARGET_ASM_SPEC
  • gcc/config/pa/pa-linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/pa/pa-linux.h gcc-4.1.1/gcc/config/pa/pa-linux.h
    old new  
    4949/* Define this for shared library support because it isn't in the main
    5050   linux.h file.  */
    5151
     52#ifdef USE_UCLIBC
     53#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     54#else
     55#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
     56#endif
    5257#undef LINK_SPEC
    5358#define LINK_SPEC "\
    5459  %{shared:-shared} \
    5560  %{!shared: \
    5661    %{!static: \
    5762      %{rdynamic:-export-dynamic} \
    58       %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
     63      %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
    5964      %{static:-static}}"
    6065
    6166/* glibc's profiling functions don't need gcc to allocate counters.  */
  • gcc/config/rs6000/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/rs6000/linux.h gcc-4.1.1/gcc/config/rs6000/linux.h
    old new  
    7272#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
    7373
    7474#undef  LINK_OS_DEFAULT_SPEC
     75#ifdef USE_UCLIBC
     76#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
     77#else
    7578#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
     79#endif
    7680
    7781#define LINK_GCC_C_SEQUENCE_SPEC \
    7882  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
  • gcc/config/rs6000/sysv4.h

    diff -Naur gcc-4.1.1.orig/gcc/config/rs6000/sysv4.h gcc-4.1.1/gcc/config/rs6000/sysv4.h
    old new  
    866866  mcall-linux  : %(link_os_linux)       ; \
    867867  mcall-gnu    : %(link_os_gnu)         ; \
    868868  mcall-netbsd : %(link_os_netbsd)      ; \
     869  mcall-linux-uclibc : %(link_os_linux_uclibc); \
    869870  mcall-openbsd: %(link_os_openbsd)     ; \
    870871               : %(link_os_default)     }"
    871872
     
    10431044  %{rdynamic:-export-dynamic} \
    10441045  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
    10451046
     1047#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
     1048  %{rdynamic:-export-dynamic} \
     1049  %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
     1050
    10461051#if defined(HAVE_LD_EH_FRAME_HDR)
    10471052# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
    10481053#endif
     
    12091214  { "link_os_sim",              LINK_OS_SIM_SPEC },                     \
    12101215  { "link_os_freebsd",          LINK_OS_FREEBSD_SPEC },                 \
    12111216  { "link_os_linux",            LINK_OS_LINUX_SPEC },                   \
     1217  { "link_os_linux_uclibc",     LINK_OS_LINUX_UCLIBC_SPEC },            \
    12121218  { "link_os_gnu",              LINK_OS_GNU_SPEC },                     \
    12131219  { "link_os_netbsd",           LINK_OS_NETBSD_SPEC },                  \
    12141220  { "link_os_openbsd",          LINK_OS_OPENBSD_SPEC },                 \
  • gcc/config/s390/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/s390/linux.h gcc-4.1.1/gcc/config/s390/linux.h
    old new  
    7777#define MULTILIB_DEFAULTS { "m31" }
    7878#endif
    7979
     80#ifdef USE_UCLIBC
     81#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     82#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
     83#else
     84#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
     85#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
     86#endif
    8087#undef  LINK_SPEC
    8188#define LINK_SPEC \
    8289  "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
     
    8693      %{!static: \
    8794        %{rdynamic:-export-dynamic} \
    8895        %{!dynamic-linker: \
    89           %{m31:-dynamic-linker /lib/ld.so.1} \
    90           %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
     96          %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
     97          %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
    9198
    9299
    93100#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
  • gcc/config/sh/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/sh/linux.h gcc-4.1.1/gcc/config/sh/linux.h
    old new  
    5656#undef SUBTARGET_LINK_EMUL_SUFFIX
    5757#define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
    5858#undef SUBTARGET_LINK_SPEC
     59#ifdef USE_UCLIBC
     60#define SUBTARGET_LINK_SPEC \
     61  "%{shared:-shared} \
     62   %{!static: \
     63     %{rdynamic:-export-dynamic} \
     64     %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
     65   %{static:-static}"
     66#else
    5967#define SUBTARGET_LINK_SPEC \
    6068  "%{shared:-shared} \
    6169   %{!static: \
    6270     %{rdynamic:-export-dynamic} \
    6371     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
    6472   %{static:-static}"
     73#endif
    6574
    6675/* Output assembler code to STREAM to call the profiler.  */
    6776
  • gcc/config/sparc/linux.h

    diff -Naur gcc-4.1.1.orig/gcc/config/sparc/linux.h gcc-4.1.1/gcc/config/sparc/linux.h
    old new  
    125125
    126126/* If ELF is the default format, we should not use /lib/elf.  */
    127127
     128#ifdef USE_UCLIBC
     129#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
     130#else
     131#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
     132#endif
    128133#undef  LINK_SPEC
    129134#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
    130135  %{!mno-relax:%{!r:-relax}} \
     
    132137    %{!ibcs: \
    133138      %{!static: \
    134139        %{rdynamic:-export-dynamic} \
    135         %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
     140        %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
    136141        %{static:-static}}}"
    137142
    138143/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
  • gcc/config/sparc/linux64.h

    diff -Naur gcc-4.1.1.orig/gcc/config/sparc/linux64.h gcc-4.1.1/gcc/config/sparc/linux64.h
    old new  
    162162  { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },        \
    163163  { "link_arch",         LINK_ARCH_SPEC },
    164164   
     165#ifdef USE_UCLIBC
     166#define ELF_DYNAMIC_LINKER      "/lib/ld-uClibc.so.0"
     167#else
     168#define ELF_DYNAMIC_LINKER  "/lib/ld-linux.so.2"
     169#endif
    165170#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
    166171  %{!shared: \
    167172    %{!ibcs: \
    168173      %{!static: \
    169174        %{rdynamic:-export-dynamic} \
    170         %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
     175        %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
    171176        %{static:-static}}} \
    172177"
    173178
  • gcc/config/t-linux-uclibc

    diff -Naur gcc-4.1.1.orig/gcc/config/t-linux-uclibc gcc-4.1.1/gcc/config/t-linux-uclibc
    old new  
     1# Remove glibc specific files added in t-linux
     2SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
     3
     4# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
     5LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
  • gcc/config.gcc

    diff -Naur gcc-4.1.1.orig/gcc/config.gcc gcc-4.1.1/gcc/config.gcc
    old new  
    672672        ;;
    673673arm*-*-linux*)                  # ARM GNU/Linux with ELF
    674674        tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
     675        case $target in
     676        arm*b-*)
     677                tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
     678                ;;
     679        esac
    675680        tmake_file="${tmake_file} t-linux arm/t-arm"
    676681        case ${target} in
    677         arm*-*-linux-gnueabi)
     682        arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
    678683            tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
    679684            tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
    680685            # The BPABI long long divmod functions return a 128-bit value in
     
    18841889        ;;
    18851890sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
    18861891sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
    1887   sh-*-linux* | sh[346lbe]*-*-linux* | \
     1892  sh*-*-linux* | sh[346lbe]*-*-linux* | \
    18881893  sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
    18891894   sh64-*-netbsd* | sh64l*-*-netbsd*)
    18901895        tmake_file="${tmake_file} sh/t-sh sh/t-elf"
     
    23382343        ;;
    23392344esac
    23402345
     2346# Rather than hook into each target, just do it after all the linux
     2347# targets have been processed
     2348case ${target} in
     2349*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
     2350esac
     2351
    23412352case ${target} in
    23422353i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1)
    23432354        tmake_file="${tmake_file} i386/t-gmm_malloc"
  • gcc/configure

    diff -Naur gcc-4.1.1.orig/gcc/configure gcc-4.1.1/gcc/configure
    old new  
    1476214762        tls_first_minor=14
    1476314763        tls_as_opt="-m64 -Aesame --fatal-warnings"
    1476414764        ;;
    14765   sh-*-* | sh[34]-*-*)
     14765  sh-*-* | sh[34]*-*-*)
    1476614766    conftest_s='
    1476714767        .section ".tdata","awT",@progbits
    1476814768foo:    .long   25
  • gcc/configure.ac

    diff -Naur gcc-4.1.1.orig/gcc/configure.ac gcc-4.1.1/gcc/configure.ac
    old new  
    24352435        tls_first_minor=14
    24362436        tls_as_opt="-m64 -Aesame --fatal-warnings"
    24372437        ;;
    2438   sh-*-* | sh[34]-*-*)
     2438  sh-*-* | sh[34]*-*-*)
    24392439    conftest_s='
    24402440        .section ".tdata","awT",@progbits
    24412441foo:    .long   25
  • libffi/configure

    diff -Naur gcc-4.1.1.orig/libffi/configure gcc-4.1.1/libffi/configure
    old new  
    34573457  lt_cv_deplibs_check_method=pass_all
    34583458  ;;
    34593459
     3460linux-uclibc*)
     3461  lt_cv_deplibs_check_method=pass_all
     3462  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     3463  ;;
     3464
    34603465netbsd* | knetbsd*-gnu)
    34613466  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    34623467    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  • libgfortran/configure

    diff -Naur gcc-4.1.1.orig/libgfortran/configure gcc-4.1.1/libgfortran/configure
    old new  
    36993699  lt_cv_deplibs_check_method=pass_all
    37003700  ;;
    37013701
     3702linux-uclibc*)
     3703  lt_cv_deplibs_check_method=pass_all
     3704  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     3705  ;;
     3706
    37023707netbsd* | knetbsd*-gnu)
    37033708  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    37043709    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  • libjava/configure

    diff -Naur gcc-4.1.1.orig/libjava/configure gcc-4.1.1/libjava/configure
    old new  
    51375137  lt_cv_deplibs_check_method=pass_all
    51385138  ;;
    51395139
     5140linux-uclibc*)
     5141  lt_cv_deplibs_check_method=pass_all
     5142  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     5143  ;;
     5144
    51405145netbsd* | knetbsd*-gnu)
    51415146  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    51425147    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  • libmudflap/configure

    diff -Naur gcc-4.1.1.orig/libmudflap/configure gcc-4.1.1/libmudflap/configure
    old new  
    53825382  lt_cv_deplibs_check_method=pass_all
    53835383  ;;
    53845384
     5385linux-uclibc*)
     5386  lt_cv_deplibs_check_method=pass_all
     5387  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     5388  ;;
     5389
    53855390netbsd* | knetbsd*-gnu)
    53865391  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    53875392    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  • libobjc/configure

    diff -Naur gcc-4.1.1.orig/libobjc/configure gcc-4.1.1/libobjc/configure
    old new  
    33123312  lt_cv_deplibs_check_method=pass_all
    33133313  ;;
    33143314
     3315linux-uclibc*)
     3316  lt_cv_deplibs_check_method=pass_all
     3317  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     3318  ;;
     3319
    33153320netbsd* | knetbsd*-gnu)
    33163321  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    33173322    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
  • libstdc++-v3/acinclude.m4

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/acinclude.m4 gcc-4.1.1/libstdc++-v3/acinclude.m4
    old new  
    10011001  AC_MSG_CHECKING([for C locale to use])
    10021002  GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
    10031003    [use MODEL for target locale package],
    1004     [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
     1004    [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
    10051005 
    10061006  # If they didn't use this option switch, or if they specified --enable
    10071007  # with no specific model, we'll have to look for one.  If they
     
    10171017  # Default to "generic".
    10181018  if test $enable_clocale_flag = auto; then
    10191019    case ${target_os} in
     1020      *-uclibc*)
     1021        enable_clocale_flag=uclibc
     1022        ;;
    10201023      linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
    10211024        AC_EGREP_CPP([_GLIBCXX_ok], [
    10221025        #include <features.h>
     
    11601163      CTIME_CC=config/locale/generic/time_members.cc
    11611164      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
    11621165      ;;
     1166    uclibc)
     1167      AC_MSG_RESULT(uclibc)
     1168
     1169      # Declare intention to use gettext, and add support for specific
     1170      # languages.
     1171      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
     1172      ALL_LINGUAS="de fr"
     1173
     1174      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
     1175      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
     1176      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
     1177        USE_NLS=yes
     1178      fi
     1179      # Export the build objects.
     1180      for ling in $ALL_LINGUAS; do \
     1181        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
     1182        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
     1183      done
     1184      AC_SUBST(glibcxx_MOFILES)
     1185      AC_SUBST(glibcxx_POFILES)
     1186
     1187      CLOCALE_H=config/locale/uclibc/c_locale.h
     1188      CLOCALE_CC=config/locale/uclibc/c_locale.cc
     1189      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
     1190      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
     1191      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
     1192      CMESSAGES_H=config/locale/uclibc/messages_members.h
     1193      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
     1194      CMONEY_CC=config/locale/uclibc/monetary_members.cc
     1195      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
     1196      CTIME_H=config/locale/uclibc/time_members.h
     1197      CTIME_CC=config/locale/uclibc/time_members.cc
     1198      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
     1199      ;;
    11631200  esac
    11641201
    11651202  # This is where the testsuite looks for locale catalogs, using the
  • libstdc++-v3/config/locale/uclibc/c++locale_internal.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.1.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
    old new  
     1// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
     2
     3// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30// Written by Jakub Jelinek <jakub@redhat.com>
     31
     32#include <bits/c++config.h>
     33#include <clocale>
     34
     35#ifdef __UCLIBC_MJN3_ONLY__
     36#warning clean this up
     37#endif
     38
     39#ifdef __UCLIBC_HAS_XLOCALE__
     40                                                 
     41extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
     42extern "C" __typeof(strcoll_l) __strcoll_l;
     43extern "C" __typeof(strftime_l) __strftime_l;
     44extern "C" __typeof(strtod_l) __strtod_l;
     45extern "C" __typeof(strtof_l) __strtof_l;
     46extern "C" __typeof(strtold_l) __strtold_l;
     47extern "C" __typeof(strxfrm_l) __strxfrm_l;
     48extern "C" __typeof(newlocale) __newlocale;
     49extern "C" __typeof(freelocale) __freelocale;
     50extern "C" __typeof(duplocale) __duplocale;
     51extern "C" __typeof(uselocale) __uselocale;
     52
     53#ifdef _GLIBCXX_USE_WCHAR_T
     54extern "C" __typeof(iswctype_l) __iswctype_l;
     55extern "C" __typeof(towlower_l) __towlower_l;
     56extern "C" __typeof(towupper_l) __towupper_l;
     57extern "C" __typeof(wcscoll_l) __wcscoll_l;
     58extern "C" __typeof(wcsftime_l) __wcsftime_l;
     59extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
     60extern "C" __typeof(wctype_l) __wctype_l;
     61#endif
     62
     63#endif // GLIBC 2.3 and later
  • libstdc++-v3/config/locale/uclibc/c_locale.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
    old new  
     1// Wrapper for underlying C-language localization -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004, 2005
     4// Free Software Foundation, Inc.
     5//
     6// This file is part of the GNU ISO C++ Library.  This library is free
     7// software; you can redistribute it and/or modify it under the
     8// terms of the GNU General Public License as published by the
     9// Free Software Foundation; either version 2, or (at your option)
     10// any later version.
     11
     12// This library is distributed in the hope that it will be useful,
     13// but WITHOUT ANY WARRANTY; without even the implied warranty of
     14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15// GNU General Public License for more details.
     16
     17// You should have received a copy of the GNU General Public License along
     18// with this library; see the file COPYING.  If not, write to the Free
     19// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     20// USA.
     21
     22// As a special exception, you may use this file as part of a free software
     23// library without restriction.  Specifically, if other files instantiate
     24// templates or use macros or inline functions from this file, or you compile
     25// this file and link it with other files to produce an executable, this
     26// file does not by itself cause the resulting executable to be covered by
     27// the GNU General Public License.  This exception does not however
     28// invalidate any other reasons why the executable file might be covered by
     29// the GNU General Public License.
     30
     31//
     32// ISO C++ 14882: 22.8  Standard locale categories.
     33//
     34
     35// Written by Benjamin Kosnik <bkoz@redhat.com>
     36
     37#include <cerrno>  // For errno
     38#include <locale>
     39#include <stdexcept>
     40#include <langinfo.h>
     41#include <bits/c++locale_internal.h>
     42
     43#ifndef __UCLIBC_HAS_XLOCALE__
     44#define __strtol_l(S, E, B, L)      strtol((S), (E), (B))
     45#define __strtoul_l(S, E, B, L)     strtoul((S), (E), (B))
     46#define __strtoll_l(S, E, B, L)     strtoll((S), (E), (B))
     47#define __strtoull_l(S, E, B, L)    strtoull((S), (E), (B))
     48#define __strtof_l(S, E, L)         strtof((S), (E))
     49#define __strtod_l(S, E, L)         strtod((S), (E))
     50#define __strtold_l(S, E, L)        strtold((S), (E))
     51#warning should dummy __newlocale check for C|POSIX ?
     52#define __newlocale(a, b, c)        NULL
     53#define __freelocale(a)             ((void)0)
     54#define __duplocale(a)              __c_locale()
     55#endif
     56
     57namespace std
     58{
     59  template<>
     60    void
     61    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
     62                   const __c_locale& __cloc)
     63    {
     64      char* __sanity;
     65      errno = 0;
     66      float __f = __strtof_l(__s, &__sanity, __cloc);
     67      if (__sanity != __s && errno != ERANGE)
     68        __v = __f;
     69      else
     70        __err |= ios_base::failbit;
     71    }
     72
     73  template<>
     74    void
     75    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
     76                   const __c_locale& __cloc)
     77    {
     78      char* __sanity;
     79      errno = 0;
     80      double __d = __strtod_l(__s, &__sanity, __cloc);
     81      if (__sanity != __s && errno != ERANGE)
     82        __v = __d;
     83      else
     84        __err |= ios_base::failbit;
     85    }
     86
     87  template<>
     88    void
     89    __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
     90                   const __c_locale& __cloc)
     91    {
     92      char* __sanity;
     93      errno = 0;
     94      long double __ld = __strtold_l(__s, &__sanity, __cloc);
     95      if (__sanity != __s && errno != ERANGE)
     96        __v = __ld;
     97      else
     98        __err |= ios_base::failbit;
     99    }
     100
     101  void
     102  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
     103                                    __c_locale __old)
     104  {
     105    __cloc = __newlocale(1 << LC_ALL, __s, __old);
     106#ifdef __UCLIBC_HAS_XLOCALE__
     107    if (!__cloc)
     108      {
     109        // This named locale is not supported by the underlying OS.
     110        __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
     111                              "name not valid"));
     112      }
     113#endif
     114  }
     115 
     116  void
     117  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
     118  {
     119    if (__cloc && _S_get_c_locale() != __cloc)
     120      __freelocale(__cloc);
     121  }
     122
     123  __c_locale
     124  locale::facet::_S_clone_c_locale(__c_locale& __cloc)
     125  { return __duplocale(__cloc); }
     126} // namespace std
     127
     128namespace __gnu_cxx
     129{
     130  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
     131    {
     132      "LC_CTYPE",
     133      "LC_NUMERIC",
     134      "LC_TIME",
     135      "LC_COLLATE",
     136      "LC_MONETARY",
     137      "LC_MESSAGES",
     138#if _GLIBCXX_NUM_CATEGORIES != 0
     139      "LC_PAPER",
     140      "LC_NAME",
     141      "LC_ADDRESS",
     142      "LC_TELEPHONE",
     143      "LC_MEASUREMENT",
     144      "LC_IDENTIFICATION"
     145#endif
     146    };
     147}
     148
     149namespace std
     150{
     151  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
     152}  // namespace std
  • libstdc++-v3/config/locale/uclibc/c_locale.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.1.1/libstdc++-v3/config/locale/uclibc/c_locale.h
    old new  
     1// Wrapper for underlying C-language localization -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.8  Standard locale categories.
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#ifndef _C_LOCALE_H
     37#define _C_LOCALE_H 1
     38
     39#pragma GCC system_header
     40
     41#include <cstring>              // get std::strlen
     42#include <cstdio>               // get std::snprintf or std::sprintf
     43#include <clocale>
     44#include <langinfo.h>           // For codecvt
     45#ifdef __UCLIBC_MJN3_ONLY__
     46#warning fix this
     47#endif
     48#ifdef __UCLIBC_HAS_LOCALE__
     49#include <iconv.h>              // For codecvt using iconv, iconv_t
     50#endif
     51#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
     52#include <libintl.h>            // For messages
     53#endif
     54
     55#ifdef __UCLIBC_MJN3_ONLY__
     56#warning what is _GLIBCXX_C_LOCALE_GNU for
     57#endif
     58#define _GLIBCXX_C_LOCALE_GNU 1
     59
     60#ifdef __UCLIBC_MJN3_ONLY__
     61#warning fix categories
     62#endif
     63// #define _GLIBCXX_NUM_CATEGORIES 6
     64#define _GLIBCXX_NUM_CATEGORIES 0
     65 
     66#ifdef __UCLIBC_HAS_XLOCALE__
     67namespace __gnu_cxx
     68{
     69  extern "C" __typeof(uselocale) __uselocale;
     70}
     71#endif
     72
     73namespace std
     74{
     75#ifdef __UCLIBC_HAS_XLOCALE__
     76  typedef __locale_t            __c_locale;
     77#else
     78  typedef int*                  __c_locale;
     79#endif
     80
     81  // Convert numeric value of type _Tv to string and return length of
     82  // string.  If snprintf is available use it, otherwise fall back to
     83  // the unsafe sprintf which, in general, can be dangerous and should
     84  // be avoided.
     85  template<typename _Tv>
     86    int
     87    __convert_from_v(char* __out,
     88                     const int __size __attribute__ ((__unused__)),
     89                     const char* __fmt,
     90#ifdef __UCLIBC_HAS_XLOCALE__
     91                     _Tv __v, const __c_locale& __cloc, int __prec)
     92    {
     93      __c_locale __old = __gnu_cxx::__uselocale(__cloc);
     94#else
     95                     _Tv __v, const __c_locale&, int __prec)
     96    {
     97# ifdef __UCLIBC_HAS_LOCALE__
     98      char* __old = std::setlocale(LC_ALL, NULL);
     99      char* __sav = new char[std::strlen(__old) + 1];
     100      std::strcpy(__sav, __old);
     101      std::setlocale(LC_ALL, "C");
     102# endif
     103#endif
     104
     105      const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
     106
     107#ifdef __UCLIBC_HAS_XLOCALE__
     108      __gnu_cxx::__uselocale(__old);
     109#elif defined __UCLIBC_HAS_LOCALE__
     110      std::setlocale(LC_ALL, __sav);
     111      delete [] __sav;
     112#endif
     113      return __ret;
     114    }
     115}
     116
     117#endif
  • libstdc++-v3/config/locale/uclibc/codecvt_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
    old new  
     1// std::codecvt implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.1.5 - Template class codecvt
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#include <locale>
     37#include <bits/c++locale_internal.h>
     38
     39namespace std
     40{
     41  // Specializations.
     42#ifdef _GLIBCXX_USE_WCHAR_T
     43  codecvt_base::result
     44  codecvt<wchar_t, char, mbstate_t>::
     45  do_out(state_type& __state, const intern_type* __from,
     46         const intern_type* __from_end, const intern_type*& __from_next,
     47         extern_type* __to, extern_type* __to_end,
     48         extern_type*& __to_next) const
     49  {
     50    result __ret = ok;
     51    state_type __tmp_state(__state);
     52
     53#ifdef __UCLIBC_HAS_XLOCALE__
     54    __c_locale __old = __uselocale(_M_c_locale_codecvt);
     55#endif
     56
     57    // wcsnrtombs is *very* fast but stops if encounters NUL characters:
     58    // in case we fall back to wcrtomb and then continue, in a loop.
     59    // NB: wcsnrtombs is a GNU extension
     60    for (__from_next = __from, __to_next = __to;
     61         __from_next < __from_end && __to_next < __to_end
     62         && __ret == ok;)
     63      {
     64        const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
     65                                                      __from_end - __from_next);
     66        if (!__from_chunk_end)
     67          __from_chunk_end = __from_end;
     68
     69        __from = __from_next;
     70        const size_t __conv = wcsnrtombs(__to_next, &__from_next,
     71                                         __from_chunk_end - __from_next,
     72                                         __to_end - __to_next, &__state);
     73        if (__conv == static_cast<size_t>(-1))
     74          {
     75            // In case of error, in order to stop at the exact place we
     76            // have to start again from the beginning with a series of
     77            // wcrtomb.
     78            for (; __from < __from_next; ++__from)
     79              __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
     80            __state = __tmp_state;
     81            __ret = error;
     82          }
     83        else if (__from_next && __from_next < __from_chunk_end)
     84          {
     85            __to_next += __conv;
     86            __ret = partial;
     87          }
     88        else
     89          {
     90            __from_next = __from_chunk_end;
     91            __to_next += __conv;
     92          }
     93
     94        if (__from_next < __from_end && __ret == ok)
     95          {
     96            extern_type __buf[MB_LEN_MAX];
     97            __tmp_state = __state;
     98            const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
     99            if (__conv > static_cast<size_t>(__to_end - __to_next))
     100              __ret = partial;
     101            else
     102              {
     103                memcpy(__to_next, __buf, __conv);
     104                __state = __tmp_state;
     105                __to_next += __conv;
     106                ++__from_next;
     107              }
     108          }
     109      }
     110
     111#ifdef __UCLIBC_HAS_XLOCALE__
     112    __uselocale(__old);
     113#endif
     114
     115    return __ret;
     116  }
     117 
     118  codecvt_base::result
     119  codecvt<wchar_t, char, mbstate_t>::
     120  do_in(state_type& __state, const extern_type* __from,
     121        const extern_type* __from_end, const extern_type*& __from_next,
     122        intern_type* __to, intern_type* __to_end,
     123        intern_type*& __to_next) const
     124  {
     125    result __ret = ok;
     126    state_type __tmp_state(__state);
     127
     128#ifdef __UCLIBC_HAS_XLOCALE__
     129    __c_locale __old = __uselocale(_M_c_locale_codecvt);
     130#endif
     131
     132    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
     133    // in case we store a L'\0' and then continue, in a loop.
     134    // NB: mbsnrtowcs is a GNU extension
     135    for (__from_next = __from, __to_next = __to;
     136         __from_next < __from_end && __to_next < __to_end
     137         && __ret == ok;)
     138      {
     139        const extern_type* __from_chunk_end;
     140        __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
     141                                                                  __from_end
     142                                                                  - __from_next));
     143        if (!__from_chunk_end)
     144          __from_chunk_end = __from_end;
     145
     146        __from = __from_next;
     147        size_t __conv = mbsnrtowcs(__to_next, &__from_next,
     148                                   __from_chunk_end - __from_next,
     149                                   __to_end - __to_next, &__state);
     150        if (__conv == static_cast<size_t>(-1))
     151          {
     152            // In case of error, in order to stop at the exact place we
     153            // have to start again from the beginning with a series of
     154            // mbrtowc.
     155            for (;; ++__to_next, __from += __conv)
     156              {
     157                __conv = mbrtowc(__to_next, __from, __from_end - __from,
     158                                 &__tmp_state);
     159                if (__conv == static_cast<size_t>(-1)
     160                    || __conv == static_cast<size_t>(-2))
     161                  break;
     162              }
     163            __from_next = __from;
     164            __state = __tmp_state;         
     165            __ret = error;
     166          }
     167        else if (__from_next && __from_next < __from_chunk_end)
     168          {
     169            // It is unclear what to return in this case (see DR 382).
     170            __to_next += __conv;
     171            __ret = partial;
     172          }
     173        else
     174          {
     175            __from_next = __from_chunk_end;
     176            __to_next += __conv;
     177          }
     178
     179        if (__from_next < __from_end && __ret == ok)
     180          {
     181            if (__to_next < __to_end)
     182              {
     183                // XXX Probably wrong for stateful encodings
     184                __tmp_state = __state;         
     185                ++__from_next;
     186                *__to_next++ = L'\0';
     187              }
     188            else
     189              __ret = partial;
     190          }
     191      }
     192
     193#ifdef __UCLIBC_HAS_XLOCALE__
     194    __uselocale(__old);
     195#endif
     196
     197    return __ret;
     198  }
     199
     200  int
     201  codecvt<wchar_t, char, mbstate_t>::
     202  do_encoding() const throw()
     203  {
     204    // XXX This implementation assumes that the encoding is
     205    // stateless and is either single-byte or variable-width.
     206    int __ret = 0;
     207#ifdef __UCLIBC_HAS_XLOCALE__
     208    __c_locale __old = __uselocale(_M_c_locale_codecvt);
     209#endif
     210    if (MB_CUR_MAX == 1)
     211      __ret = 1;
     212#ifdef __UCLIBC_HAS_XLOCALE__
     213    __uselocale(__old);
     214#endif
     215    return __ret;
     216  } 
     217
     218  int
     219  codecvt<wchar_t, char, mbstate_t>::
     220  do_max_length() const throw()
     221  {
     222#ifdef __UCLIBC_HAS_XLOCALE__
     223    __c_locale __old = __uselocale(_M_c_locale_codecvt);
     224#endif
     225    // XXX Probably wrong for stateful encodings.
     226    int __ret = MB_CUR_MAX;
     227#ifdef __UCLIBC_HAS_XLOCALE__
     228    __uselocale(__old);
     229#endif
     230    return __ret;
     231  }
     232 
     233  int
     234  codecvt<wchar_t, char, mbstate_t>::
     235  do_length(state_type& __state, const extern_type* __from,
     236            const extern_type* __end, size_t __max) const
     237  {
     238    int __ret = 0;
     239    state_type __tmp_state(__state);
     240
     241#ifdef __UCLIBC_HAS_XLOCALE__
     242    __c_locale __old = __uselocale(_M_c_locale_codecvt);
     243#endif
     244
     245    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
     246    // in case we advance past it and then continue, in a loop.
     247    // NB: mbsnrtowcs is a GNU extension
     248 
     249    // A dummy internal buffer is needed in order for mbsnrtocws to consider
     250    // its fourth parameter (it wouldn't with NULL as first parameter).
     251    wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
     252                                                           * __max));
     253    while (__from < __end && __max)
     254      {
     255        const extern_type* __from_chunk_end;
     256        __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
     257                                                                  __end
     258                                                                  - __from));
     259        if (!__from_chunk_end)
     260          __from_chunk_end = __end;
     261
     262        const extern_type* __tmp_from = __from;
     263        size_t __conv = mbsnrtowcs(__to, &__from,
     264                                   __from_chunk_end - __from,
     265                                   __max, &__state);
     266        if (__conv == static_cast<size_t>(-1))
     267          {
     268            // In case of error, in order to stop at the exact place we
     269            // have to start again from the beginning with a series of
     270            // mbrtowc.
     271            for (__from = __tmp_from;; __from += __conv)
     272              {
     273                __conv = mbrtowc(NULL, __from, __end - __from,
     274                                 &__tmp_state);
     275                if (__conv == static_cast<size_t>(-1)
     276                    || __conv == static_cast<size_t>(-2))
     277                  break;
     278              }
     279            __state = __tmp_state;
     280            __ret += __from - __tmp_from;
     281            break;
     282          }
     283        if (!__from)
     284          __from = __from_chunk_end;
     285       
     286        __ret += __from - __tmp_from;
     287        __max -= __conv;
     288
     289        if (__from < __end && __max)
     290          {
     291            // XXX Probably wrong for stateful encodings
     292            __tmp_state = __state;
     293            ++__from;
     294            ++__ret;
     295            --__max;
     296          }
     297      }
     298
     299#ifdef __UCLIBC_HAS_XLOCALE__
     300    __uselocale(__old);
     301#endif
     302
     303    return __ret;
     304  }
     305#endif
     306}
  • libstdc++-v3/config/locale/uclibc/collate_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
    old new  
     1// std::collate implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.4.1.2  collate virtual functions
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#include <locale>
     37#include <bits/c++locale_internal.h>
     38
     39#ifndef __UCLIBC_HAS_XLOCALE__
     40#define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
     41#define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
     42#define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
     43#define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
     44#endif
     45
     46namespace std
     47{
     48  // These are basically extensions to char_traits, and perhaps should
     49  // be put there instead of here.
     50  template<>
     51    int
     52    collate<char>::_M_compare(const char* __one, const char* __two) const
     53    {
     54      int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
     55      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
     56    }
     57 
     58  template<>
     59    size_t
     60    collate<char>::_M_transform(char* __to, const char* __from,
     61                                size_t __n) const
     62    { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
     63
     64#ifdef _GLIBCXX_USE_WCHAR_T
     65  template<>
     66    int
     67    collate<wchar_t>::_M_compare(const wchar_t* __one,
     68                                 const wchar_t* __two) const
     69    {
     70      int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
     71      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
     72    }
     73 
     74  template<>
     75    size_t
     76    collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
     77                                   size_t __n) const
     78    { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
     79#endif
     80}
  • libstdc++-v3/config/locale/uclibc/ctype_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
    old new  
     1// std::ctype implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#define _LIBC
     37#include <locale>
     38#undef _LIBC
     39#include <bits/c++locale_internal.h>
     40
     41#ifndef __UCLIBC_HAS_XLOCALE__
     42#define __wctype_l(S, L)           wctype((S))
     43#define __towupper_l(C, L)         towupper((C))
     44#define __towlower_l(C, L)         towlower((C))
     45#define __iswctype_l(C, M, L)      iswctype((C), (M))
     46#endif
     47
     48namespace std
     49{
     50  // NB: The other ctype<char> specializations are in src/locale.cc and
     51  // various /config/os/* files.
     52  template<>
     53    ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
     54    : ctype<char>(0, false, __refs)
     55    {           
     56      if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
     57        {
     58          this->_S_destroy_c_locale(this->_M_c_locale_ctype);
     59          this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
     60#ifdef __UCLIBC_HAS_XLOCALE__
     61          this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
     62          this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
     63          this->_M_table = this->_M_c_locale_ctype->__ctype_b;
     64#endif
     65        }
     66    }
     67
     68#ifdef _GLIBCXX_USE_WCHAR_T 
     69  ctype<wchar_t>::__wmask_type
     70  ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
     71  {
     72    __wmask_type __ret;
     73    switch (__m)
     74      {
     75      case space:
     76        __ret = __wctype_l("space", _M_c_locale_ctype);
     77        break;
     78      case print:
     79        __ret = __wctype_l("print", _M_c_locale_ctype);
     80        break;
     81      case cntrl:
     82        __ret = __wctype_l("cntrl", _M_c_locale_ctype);
     83        break;
     84      case upper:
     85        __ret = __wctype_l("upper", _M_c_locale_ctype);
     86        break;
     87      case lower:
     88        __ret = __wctype_l("lower", _M_c_locale_ctype);
     89        break;
     90      case alpha:
     91        __ret = __wctype_l("alpha", _M_c_locale_ctype);
     92        break;
     93      case digit:
     94        __ret = __wctype_l("digit", _M_c_locale_ctype);
     95        break;
     96      case punct:
     97        __ret = __wctype_l("punct", _M_c_locale_ctype);
     98        break;
     99      case xdigit:
     100        __ret = __wctype_l("xdigit", _M_c_locale_ctype);
     101        break;
     102      case alnum:
     103        __ret = __wctype_l("alnum", _M_c_locale_ctype);
     104        break;
     105      case graph:
     106        __ret = __wctype_l("graph", _M_c_locale_ctype);
     107        break;
     108      default:
     109        __ret = __wmask_type();
     110      }
     111    return __ret;
     112  }
     113 
     114  wchar_t
     115  ctype<wchar_t>::do_toupper(wchar_t __c) const
     116  { return __towupper_l(__c, _M_c_locale_ctype); }
     117
     118  const wchar_t*
     119  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
     120  {
     121    while (__lo < __hi)
     122      {
     123        *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
     124        ++__lo;
     125      }
     126    return __hi;
     127  }
     128 
     129  wchar_t
     130  ctype<wchar_t>::do_tolower(wchar_t __c) const
     131  { return __towlower_l(__c, _M_c_locale_ctype); }
     132 
     133  const wchar_t*
     134  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
     135  {
     136    while (__lo < __hi)
     137      {
     138        *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
     139        ++__lo;
     140      }
     141    return __hi;
     142  }
     143
     144  bool
     145  ctype<wchar_t>::
     146  do_is(mask __m, wchar_t __c) const
     147  {
     148    // The case of __m == ctype_base::space is particularly important,
     149    // due to its use in many istream functions.  Therefore we deal with
     150    // it first, exploiting the knowledge that on GNU systems _M_bit[5]
     151    // is the mask corresponding to ctype_base::space.  NB: an encoding
     152    // change would not affect correctness!
     153    bool __ret = false;
     154    if (__m == _M_bit[5])
     155      __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
     156    else
     157      {
     158        // Highest bitmask in ctype_base == 10, but extra in "C"
     159        // library for blank.
     160        const size_t __bitmasksize = 11;
     161        for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
     162          if (__m & _M_bit[__bitcur])
     163            {
     164              if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
     165                {
     166                  __ret = true;
     167                  break;
     168                }
     169              else if (__m == _M_bit[__bitcur])
     170                break;
     171            }
     172      }
     173    return __ret;   
     174  }
     175
     176  const wchar_t*
     177  ctype<wchar_t>::
     178  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
     179  {
     180    for (; __lo < __hi; ++__vec, ++__lo)
     181      {
     182        // Highest bitmask in ctype_base == 10, but extra in "C"
     183        // library for blank.
     184        const size_t __bitmasksize = 11;
     185        mask __m = 0;
     186        for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
     187          if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
     188            __m |= _M_bit[__bitcur];
     189        *__vec = __m;
     190      }
     191    return __hi;
     192  }
     193 
     194  const wchar_t*
     195  ctype<wchar_t>::
     196  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
     197  {
     198    while (__lo < __hi && !this->do_is(__m, *__lo))
     199      ++__lo;
     200    return __lo;
     201  }
     202
     203  const wchar_t*
     204  ctype<wchar_t>::
     205  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
     206  {
     207    while (__lo < __hi && this->do_is(__m, *__lo) != 0)
     208      ++__lo;
     209    return __lo;
     210  }
     211
     212  wchar_t
     213  ctype<wchar_t>::
     214  do_widen(char __c) const
     215  { return _M_widen[static_cast<unsigned char>(__c)]; }
     216
     217  const char*
     218  ctype<wchar_t>::
     219  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
     220  {
     221    while (__lo < __hi)
     222      {
     223        *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
     224        ++__lo;
     225        ++__dest;
     226      }
     227    return __hi;
     228  }
     229
     230  char
     231  ctype<wchar_t>::
     232  do_narrow(wchar_t __wc, char __dfault) const
     233  {
     234    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
     235      return _M_narrow[__wc];
     236#ifdef __UCLIBC_HAS_XLOCALE__
     237    __c_locale __old = __uselocale(_M_c_locale_ctype);
     238#endif
     239    const int __c = wctob(__wc);
     240#ifdef __UCLIBC_HAS_XLOCALE__
     241    __uselocale(__old);
     242#endif
     243    return (__c == EOF ? __dfault : static_cast<char>(__c));
     244  }
     245
     246  const wchar_t*
     247  ctype<wchar_t>::
     248  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
     249            char* __dest) const
     250  {
     251#ifdef __UCLIBC_HAS_XLOCALE__
     252    __c_locale __old = __uselocale(_M_c_locale_ctype);
     253#endif
     254    if (_M_narrow_ok)
     255      while (__lo < __hi)
     256        {
     257          if (*__lo >= 0 && *__lo < 128)
     258            *__dest = _M_narrow[*__lo];
     259          else
     260            {
     261              const int __c = wctob(*__lo);
     262              *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
     263            }
     264          ++__lo;
     265          ++__dest;
     266        }
     267    else
     268      while (__lo < __hi)
     269        {
     270          const int __c = wctob(*__lo);
     271          *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
     272          ++__lo;
     273          ++__dest;
     274        }
     275#ifdef __UCLIBC_HAS_XLOCALE__
     276    __uselocale(__old);
     277#endif
     278    return __hi;
     279  }
     280
     281  void
     282  ctype<wchar_t>::_M_initialize_ctype()
     283  {
     284#ifdef __UCLIBC_HAS_XLOCALE__
     285    __c_locale __old = __uselocale(_M_c_locale_ctype);
     286#endif
     287    wint_t __i;
     288    for (__i = 0; __i < 128; ++__i)
     289      {
     290        const int __c = wctob(__i);
     291        if (__c == EOF)
     292          break;
     293        else
     294          _M_narrow[__i] = static_cast<char>(__c);
     295      }
     296    if (__i == 128)
     297      _M_narrow_ok = true;
     298    else
     299      _M_narrow_ok = false;
     300    for (size_t __j = 0;
     301         __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
     302      _M_widen[__j] = btowc(__j);
     303
     304    for (size_t __k = 0; __k <= 11; ++__k)
     305      {
     306        _M_bit[__k] = static_cast<mask>(_ISbit(__k));
     307        _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
     308      }
     309#ifdef __UCLIBC_HAS_XLOCALE__
     310    __uselocale(__old);
     311#endif
     312  }
     313#endif //  _GLIBCXX_USE_WCHAR_T
     314}
  • libstdc++-v3/config/locale/uclibc/messages_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
    old new  
     1// std::messages implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#include <locale>
     37#include <bits/c++locale_internal.h>
     38
     39#ifdef __UCLIBC_MJN3_ONLY__
     40#warning fix gettext stuff
     41#endif
     42#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
     43extern "C" char *__dcgettext(const char *domainname,
     44                             const char *msgid, int category);
     45#undef gettext
     46#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
     47#else
     48#undef gettext
     49#define gettext(msgid) (msgid)
     50#endif
     51
     52namespace std
     53{
     54  // Specializations.
     55  template<>
     56    string
     57    messages<char>::do_get(catalog, int, int, const string& __dfault) const
     58    {
     59#ifdef __UCLIBC_HAS_XLOCALE__
     60      __c_locale __old = __uselocale(_M_c_locale_messages);
     61      const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
     62      __uselocale(__old);
     63      return string(__msg);
     64#elif defined __UCLIBC_HAS_LOCALE__
     65      char* __old = strdup(setlocale(LC_ALL, NULL));
     66      setlocale(LC_ALL, _M_name_messages);
     67      const char* __msg = gettext(__dfault.c_str());
     68      setlocale(LC_ALL, __old);
     69      free(__old);
     70      return string(__msg);
     71#else
     72      const char* __msg = gettext(__dfault.c_str());
     73      return string(__msg);
     74#endif
     75    }
     76
     77#ifdef _GLIBCXX_USE_WCHAR_T
     78  template<>
     79    wstring
     80    messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
     81    {
     82# ifdef __UCLIBC_HAS_XLOCALE__
     83      __c_locale __old = __uselocale(_M_c_locale_messages);
     84      char* __msg = gettext(_M_convert_to_char(__dfault));
     85      __uselocale(__old);
     86      return _M_convert_from_char(__msg);
     87# elif defined __UCLIBC_HAS_LOCALE__
     88      char* __old = strdup(setlocale(LC_ALL, NULL));
     89      setlocale(LC_ALL, _M_name_messages);
     90      char* __msg = gettext(_M_convert_to_char(__dfault));
     91      setlocale(LC_ALL, __old);
     92      free(__old);
     93      return _M_convert_from_char(__msg);
     94# else
     95      char* __msg = gettext(_M_convert_to_char(__dfault));
     96      return _M_convert_from_char(__msg);
     97# endif
     98    }
     99#endif
     100}
  • libstdc++-v3/config/locale/uclibc/messages_members.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.1.1/libstdc++-v3/config/locale/uclibc/messages_members.h
    old new  
     1// std::messages implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.7.1.2  messages functions
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#ifdef __UCLIBC_MJN3_ONLY__
     37#warning fix prototypes for *textdomain funcs
     38#endif
     39#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
     40extern "C" char *__textdomain(const char *domainname);
     41extern "C" char *__bindtextdomain(const char *domainname,
     42                                  const char *dirname);
     43#else
     44#undef __textdomain
     45#undef __bindtextdomain
     46#define __textdomain(D)           ((void)0)
     47#define __bindtextdomain(D,P)     ((void)0)
     48#endif
     49
     50  // Non-virtual member functions.
     51  template<typename _CharT>
     52     messages<_CharT>::messages(size_t __refs)
     53     : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
     54       _M_name_messages(_S_get_c_name())
     55     { }
     56
     57  template<typename _CharT>
     58     messages<_CharT>::messages(__c_locale __cloc, const char* __s,
     59                                size_t __refs)
     60     : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
     61     {
     62       const size_t __len = std::strlen(__s) + 1;
     63       char* __tmp = new char[__len];
     64       std::memcpy(__tmp, __s, __len);
     65       _M_name_messages = __tmp;
     66
     67       // Last to avoid leaking memory if new throws.
     68       _M_c_locale_messages = _S_clone_c_locale(__cloc);
     69     }
     70
     71  template<typename _CharT>
     72    typename messages<_CharT>::catalog
     73    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
     74                           const char* __dir) const
     75    {
     76      __bindtextdomain(__s.c_str(), __dir);
     77      return this->do_open(__s, __loc);
     78    }
     79
     80  // Virtual member functions.
     81  template<typename _CharT>
     82    messages<_CharT>::~messages()
     83    {
     84      if (_M_name_messages != _S_get_c_name())
     85        delete [] _M_name_messages;
     86      _S_destroy_c_locale(_M_c_locale_messages);
     87    }
     88
     89  template<typename _CharT>
     90    typename messages<_CharT>::catalog
     91    messages<_CharT>::do_open(const basic_string<char>& __s,
     92                              const locale&) const
     93    {
     94      // No error checking is done, assume the catalog exists and can
     95      // be used.
     96      __textdomain(__s.c_str());
     97      return 0;
     98    }
     99
     100  template<typename _CharT>
     101    void   
     102    messages<_CharT>::do_close(catalog) const
     103    { }
     104
     105   // messages_byname
     106   template<typename _CharT>
     107     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
     108     : messages<_CharT>(__refs)
     109     {
     110       if (this->_M_name_messages != locale::facet::_S_get_c_name())
     111         delete [] this->_M_name_messages;
     112       char* __tmp = new char[std::strlen(__s) + 1];
     113       std::strcpy(__tmp, __s);
     114       this->_M_name_messages = __tmp;
     115
     116       if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
     117         {
     118           this->_S_destroy_c_locale(this->_M_c_locale_messages);
     119           this->_S_create_c_locale(this->_M_c_locale_messages, __s);
     120         }
     121     }
  • libstdc++-v3/config/locale/uclibc/monetary_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
    old new  
     1// std::moneypunct implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.6.3.2  moneypunct virtual functions
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#define _LIBC
     37#include <locale>
     38#undef _LIBC
     39#include <bits/c++locale_internal.h>
     40
     41#ifdef __UCLIBC_MJN3_ONLY__
     42#warning optimize this for uclibc
     43#warning tailor for stub locale support
     44#endif
     45
     46#ifndef __UCLIBC_HAS_XLOCALE__
     47#define __nl_langinfo_l(N, L)         nl_langinfo((N))
     48#endif
     49
     50namespace std
     51{
     52  // Construct and return valid pattern consisting of some combination of:
     53  // space none symbol sign value
     54  money_base::pattern
     55  money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
     56  {
     57    pattern __ret;
     58
     59    // This insanely complicated routine attempts to construct a valid
     60    // pattern for use with monyepunct. A couple of invariants:
     61
     62    // if (__precedes) symbol -> value
     63    // else value -> symbol
     64   
     65    // if (__space) space
     66    // else none
     67
     68    // none == never first
     69    // space never first or last
     70
     71    // Any elegant implementations of this are welcome.
     72    switch (__posn)
     73      {
     74      case 0:
     75      case 1:
     76        // 1 The sign precedes the value and symbol.
     77        __ret.field[0] = sign;
     78        if (__space)
     79          {
     80            // Pattern starts with sign.
     81            if (__precedes)
     82              {
     83                __ret.field[1] = symbol;
     84                __ret.field[3] = value;
     85              }
     86            else
     87              {
     88                __ret.field[1] = value;
     89                __ret.field[3] = symbol;
     90              }
     91            __ret.field[2] = space;
     92          }
     93        else
     94          {
     95            // Pattern starts with sign and ends with none.
     96            if (__precedes)
     97              {
     98                __ret.field[1] = symbol;
     99                __ret.field[2] = value;
     100              }
     101            else
     102              {
     103                __ret.field[1] = value;
     104                __ret.field[2] = symbol;
     105              }
     106            __ret.field[3] = none;
     107          }
     108        break;
     109      case 2:
     110        // 2 The sign follows the value and symbol.
     111        if (__space)
     112          {
     113            // Pattern either ends with sign.
     114            if (__precedes)
     115              {
     116                __ret.field[0] = symbol;
     117                __ret.field[2] = value;
     118              }
     119            else
     120              {
     121                __ret.field[0] = value;
     122                __ret.field[2] = symbol;
     123              }
     124            __ret.field[1] = space;
     125            __ret.field[3] = sign;
     126          }
     127        else
     128          {
     129            // Pattern ends with sign then none.
     130            if (__precedes)
     131              {
     132                __ret.field[0] = symbol;
     133                __ret.field[1] = value;
     134              }
     135            else
     136              {
     137                __ret.field[0] = value;
     138                __ret.field[1] = symbol;
     139              }
     140            __ret.field[2] = sign;
     141            __ret.field[3] = none;
     142          }
     143        break;
     144      case 3:
     145        // 3 The sign immediately precedes the symbol.
     146        if (__precedes)
     147          {
     148            __ret.field[0] = sign;
     149            __ret.field[1] = symbol;       
     150            if (__space)
     151              {
     152                __ret.field[2] = space;
     153                __ret.field[3] = value;
     154              }
     155            else
     156              {
     157                __ret.field[2] = value;         
     158                __ret.field[3] = none;
     159              }
     160          }
     161        else
     162          {
     163            __ret.field[0] = value;
     164            if (__space)
     165              {
     166                __ret.field[1] = space;
     167                __ret.field[2] = sign;
     168                __ret.field[3] = symbol;
     169              }
     170            else
     171              {
     172                __ret.field[1] = sign;
     173                __ret.field[2] = symbol;
     174                __ret.field[3] = none;
     175              }
     176          }
     177        break;
     178      case 4:
     179        // 4 The sign immediately follows the symbol.
     180        if (__precedes)
     181          {
     182            __ret.field[0] = symbol;
     183            __ret.field[1] = sign;
     184            if (__space)
     185              {
     186                __ret.field[2] = space;
     187                __ret.field[3] = value;
     188              }
     189            else
     190              {
     191                __ret.field[2] = value;
     192                __ret.field[3] = none;
     193              }
     194          }
     195        else
     196          {
     197            __ret.field[0] = value;
     198            if (__space)
     199              {
     200                __ret.field[1] = space;
     201                __ret.field[2] = symbol;
     202                __ret.field[3] = sign;
     203              }
     204            else
     205              {
     206                __ret.field[1] = symbol;
     207                __ret.field[2] = sign;
     208                __ret.field[3] = none;
     209              }
     210          }
     211        break;
     212      default:
     213        __ret = pattern();
     214      }
     215    return __ret;
     216  }
     217
     218  template<>
     219    void
     220    moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
     221                                                     const char*)
     222    {
     223      if (!_M_data)
     224        _M_data = new __moneypunct_cache<char, true>;
     225
     226      if (!__cloc)
     227        {
     228          // "C" locale
     229          _M_data->_M_decimal_point = '.';
     230          _M_data->_M_thousands_sep = ',';
     231          _M_data->_M_grouping = "";
     232          _M_data->_M_grouping_size = 0;
     233          _M_data->_M_curr_symbol = "";
     234          _M_data->_M_curr_symbol_size = 0;
     235          _M_data->_M_positive_sign = "";
     236          _M_data->_M_positive_sign_size = 0;
     237          _M_data->_M_negative_sign = "";
     238          _M_data->_M_negative_sign_size = 0;
     239          _M_data->_M_frac_digits = 0;
     240          _M_data->_M_pos_format = money_base::_S_default_pattern;
     241          _M_data->_M_neg_format = money_base::_S_default_pattern;
     242
     243          for (size_t __i = 0; __i < money_base::_S_end; ++__i)
     244            _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
     245        }
     246      else
     247        {
     248          // Named locale.
     249          _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
     250                                                        __cloc));
     251          _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
     252                                                        __cloc));
     253          _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
     254          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
     255          _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
     256          _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
     257
     258          char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
     259          if (!__nposn)
     260            _M_data->_M_negative_sign = "()";
     261          else
     262            _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
     263                                                        __cloc);
     264          _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
     265
     266          // _Intl == true
     267          _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
     268          _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
     269          _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
     270                                                      __cloc));
     271          char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
     272          char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
     273          char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
     274          _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
     275                                                        __pposn);
     276          char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
     277          char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
     278          _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
     279                                                        __nposn);
     280        }
     281    }
     282
     283  template<>
     284    void
     285    moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
     286                                                      const char*)
     287    {
     288      if (!_M_data)
     289        _M_data = new __moneypunct_cache<char, false>;
     290
     291      if (!__cloc)
     292        {
     293          // "C" locale
     294          _M_data->_M_decimal_point = '.';
     295          _M_data->_M_thousands_sep = ',';
     296          _M_data->_M_grouping = "";
     297          _M_data->_M_grouping_size = 0;
     298          _M_data->_M_curr_symbol = "";
     299          _M_data->_M_curr_symbol_size = 0;
     300          _M_data->_M_positive_sign = "";
     301          _M_data->_M_positive_sign_size = 0;
     302          _M_data->_M_negative_sign = "";
     303          _M_data->_M_negative_sign_size = 0;
     304          _M_data->_M_frac_digits = 0;
     305          _M_data->_M_pos_format = money_base::_S_default_pattern;
     306          _M_data->_M_neg_format = money_base::_S_default_pattern;
     307
     308          for (size_t __i = 0; __i < money_base::_S_end; ++__i)
     309            _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
     310        }
     311      else
     312        {
     313          // Named locale.
     314          _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
     315                                                        __cloc));
     316          _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
     317                                                        __cloc));
     318          _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
     319          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
     320          _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
     321          _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
     322
     323          char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
     324          if (!__nposn)
     325            _M_data->_M_negative_sign = "()";
     326          else
     327            _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
     328                                                        __cloc);
     329          _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
     330
     331          // _Intl == false
     332          _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
     333          _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
     334          _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
     335          char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
     336          char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
     337          char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
     338          _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
     339                                                        __pposn);
     340          char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
     341          char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
     342          _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
     343                                                        __nposn);
     344        }
     345    }
     346
     347  template<>
     348    moneypunct<char, true>::~moneypunct()
     349    { delete _M_data; }
     350
     351  template<>
     352    moneypunct<char, false>::~moneypunct()
     353    { delete _M_data; }
     354
     355#ifdef _GLIBCXX_USE_WCHAR_T
     356  template<>
     357    void
     358    moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
     359#ifdef __UCLIBC_HAS_XLOCALE__
     360                                                        const char*)
     361#else
     362                                                        const char* __name)
     363#endif
     364    {
     365      if (!_M_data)
     366        _M_data = new __moneypunct_cache<wchar_t, true>;
     367
     368      if (!__cloc)
     369        {
     370          // "C" locale
     371          _M_data->_M_decimal_point = L'.';
     372          _M_data->_M_thousands_sep = L',';
     373          _M_data->_M_grouping = "";
     374          _M_data->_M_grouping_size = 0;
     375          _M_data->_M_curr_symbol = L"";
     376          _M_data->_M_curr_symbol_size = 0;
     377          _M_data->_M_positive_sign = L"";
     378          _M_data->_M_positive_sign_size = 0;
     379          _M_data->_M_negative_sign = L"";
     380          _M_data->_M_negative_sign_size = 0;
     381          _M_data->_M_frac_digits = 0;
     382          _M_data->_M_pos_format = money_base::_S_default_pattern;
     383          _M_data->_M_neg_format = money_base::_S_default_pattern;
     384
     385          // Use ctype::widen code without the facet...
     386          for (size_t __i = 0; __i < money_base::_S_end; ++__i)
     387            _M_data->_M_atoms[__i] =
     388              static_cast<wchar_t>(money_base::_S_atoms[__i]);
     389        }
     390      else
     391        {
     392          // Named locale.
     393#ifdef __UCLIBC_HAS_XLOCALE__
     394          __c_locale __old = __uselocale(__cloc);
     395#else
     396          // Switch to named locale so that mbsrtowcs will work.
     397          char* __old = strdup(setlocale(LC_ALL, NULL));
     398          setlocale(LC_ALL, __name);
     399#endif
     400
     401#ifdef __UCLIBC_MJN3_ONLY__
     402#warning fix this... should be monetary
     403#endif
     404#ifdef __UCLIBC__
     405# ifdef __UCLIBC_HAS_XLOCALE__
     406          _M_data->_M_decimal_point = __cloc->decimal_point_wc;
     407          _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
     408# elif defined __UCLIBC_HAS_LOCALE__
     409          _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
     410          _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
     411# endif
     412#else
     413          union { char *__s; wchar_t __w; } __u;
     414          __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
     415          _M_data->_M_decimal_point = __u.__w;
     416
     417          __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
     418          _M_data->_M_thousands_sep = __u.__w;
     419#endif
     420          _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
     421          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
     422
     423          const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
     424          const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
     425          const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
     426
     427          wchar_t* __wcs_ps = 0;
     428          wchar_t* __wcs_ns = 0;
     429          const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
     430          try
     431            {
     432              mbstate_t __state;
     433              size_t __len = strlen(__cpossign);
     434              if (__len)
     435                {
     436                  ++__len;
     437                  memset(&__state, 0, sizeof(mbstate_t));
     438                  __wcs_ps = new wchar_t[__len];
     439                  mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
     440                  _M_data->_M_positive_sign = __wcs_ps;
     441                }
     442              else
     443                _M_data->_M_positive_sign = L"";
     444              _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
     445             
     446              __len = strlen(__cnegsign);
     447              if (!__nposn)
     448                _M_data->_M_negative_sign = L"()";
     449              else if (__len)
     450                {
     451                  ++__len;
     452                  memset(&__state, 0, sizeof(mbstate_t));
     453                  __wcs_ns = new wchar_t[__len];
     454                  mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
     455                  _M_data->_M_negative_sign = __wcs_ns;
     456                }
     457              else
     458                _M_data->_M_negative_sign = L"";
     459              _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
     460             
     461              // _Intl == true.
     462              __len = strlen(__ccurr);
     463              if (__len)
     464                {
     465                  ++__len;
     466                  memset(&__state, 0, sizeof(mbstate_t));
     467                  wchar_t* __wcs = new wchar_t[__len];
     468                  mbsrtowcs(__wcs, &__ccurr, __len, &__state);
     469                  _M_data->_M_curr_symbol = __wcs;
     470                }
     471              else
     472                _M_data->_M_curr_symbol = L"";
     473              _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
     474            }
     475          catch (...)
     476            {
     477              delete _M_data;
     478              _M_data = 0;
     479              delete __wcs_ps;
     480              delete __wcs_ns;       
     481#ifdef __UCLIBC_HAS_XLOCALE__
     482              __uselocale(__old);
     483#else
     484              setlocale(LC_ALL, __old);
     485              free(__old);
     486#endif
     487              __throw_exception_again;
     488            }
     489         
     490          _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
     491                                                      __cloc));
     492          char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
     493          char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
     494          char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
     495          _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
     496                                                        __pposn);
     497          char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
     498          char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
     499          _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
     500                                                        __nposn);
     501
     502#ifdef __UCLIBC_HAS_XLOCALE__
     503          __uselocale(__old);
     504#else
     505          setlocale(LC_ALL, __old);
     506          free(__old);
     507#endif
     508        }
     509    }
     510
     511  template<>
     512  void
     513  moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
     514#ifdef __UCLIBC_HAS_XLOCALE__
     515                                                       const char*)
     516#else
     517                                                       const char* __name)
     518#endif
     519  {
     520    if (!_M_data)
     521      _M_data = new __moneypunct_cache<wchar_t, false>;
     522
     523    if (!__cloc)
     524        {
     525          // "C" locale
     526          _M_data->_M_decimal_point = L'.';
     527          _M_data->_M_thousands_sep = L',';
     528          _M_data->_M_grouping = "";
     529          _M_data->_M_grouping_size = 0;
     530          _M_data->_M_curr_symbol = L"";
     531          _M_data->_M_curr_symbol_size = 0;
     532          _M_data->_M_positive_sign = L"";
     533          _M_data->_M_positive_sign_size = 0;
     534          _M_data->_M_negative_sign = L"";
     535          _M_data->_M_negative_sign_size = 0;
     536          _M_data->_M_frac_digits = 0;
     537          _M_data->_M_pos_format = money_base::_S_default_pattern;
     538          _M_data->_M_neg_format = money_base::_S_default_pattern;
     539
     540          // Use ctype::widen code without the facet...
     541          for (size_t __i = 0; __i < money_base::_S_end; ++__i)
     542            _M_data->_M_atoms[__i] =
     543              static_cast<wchar_t>(money_base::_S_atoms[__i]);
     544        }
     545      else
     546        {
     547          // Named locale.
     548#ifdef __UCLIBC_HAS_XLOCALE__
     549          __c_locale __old = __uselocale(__cloc);
     550#else
     551          // Switch to named locale so that mbsrtowcs will work.
     552          char* __old = strdup(setlocale(LC_ALL, NULL));
     553          setlocale(LC_ALL, __name);
     554#endif
     555
     556#ifdef __UCLIBC_MJN3_ONLY__
     557#warning fix this... should be monetary
     558#endif
     559#ifdef __UCLIBC__
     560# ifdef __UCLIBC_HAS_XLOCALE__
     561          _M_data->_M_decimal_point = __cloc->decimal_point_wc;
     562          _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
     563# elif defined __UCLIBC_HAS_LOCALE__
     564          _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
     565          _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
     566# endif
     567#else
     568          union { char *__s; wchar_t __w; } __u;
     569          __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
     570          _M_data->_M_decimal_point = __u.__w;
     571
     572          __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
     573          _M_data->_M_thousands_sep = __u.__w;
     574#endif
     575          _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
     576          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
     577
     578          const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
     579          const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
     580          const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
     581
     582          wchar_t* __wcs_ps = 0;
     583          wchar_t* __wcs_ns = 0;
     584          const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
     585          try
     586            {
     587              mbstate_t __state;
     588              size_t __len;
     589              __len = strlen(__cpossign);
     590              if (__len)
     591                {
     592                  ++__len;
     593                  memset(&__state, 0, sizeof(mbstate_t));
     594                  __wcs_ps = new wchar_t[__len];
     595                  mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
     596                  _M_data->_M_positive_sign = __wcs_ps;
     597                }
     598              else
     599                _M_data->_M_positive_sign = L"";
     600              _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
     601             
     602              __len = strlen(__cnegsign);
     603              if (!__nposn)
     604                _M_data->_M_negative_sign = L"()";
     605              else if (__len)
     606                {
     607                  ++__len;
     608                  memset(&__state, 0, sizeof(mbstate_t));
     609                  __wcs_ns = new wchar_t[__len];
     610                  mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
     611                  _M_data->_M_negative_sign = __wcs_ns;
     612                }
     613              else
     614                _M_data->_M_negative_sign = L"";
     615              _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
     616
     617              // _Intl == true.
     618              __len = strlen(__ccurr);
     619              if (__len)
     620                {
     621                  ++__len;
     622                  memset(&__state, 0, sizeof(mbstate_t));
     623                  wchar_t* __wcs = new wchar_t[__len];
     624                  mbsrtowcs(__wcs, &__ccurr, __len, &__state);
     625                  _M_data->_M_curr_symbol = __wcs;
     626                }
     627              else
     628                _M_data->_M_curr_symbol = L"";
     629              _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
     630            }
     631          catch (...)
     632            {
     633              delete _M_data;
     634              _M_data = 0;
     635              delete __wcs_ps;
     636              delete __wcs_ns;       
     637#ifdef __UCLIBC_HAS_XLOCALE__
     638              __uselocale(__old);
     639#else
     640              setlocale(LC_ALL, __old);
     641              free(__old);
     642#endif
     643              __throw_exception_again;
     644            }
     645
     646          _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
     647          char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
     648          char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
     649          char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
     650          _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
     651                                                        __pposn);
     652          char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
     653          char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
     654          _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
     655                                                        __nposn);
     656
     657#ifdef __UCLIBC_HAS_XLOCALE__
     658          __uselocale(__old);
     659#else
     660          setlocale(LC_ALL, __old);
     661          free(__old);
     662#endif
     663        }
     664    }
     665
     666  template<>
     667    moneypunct<wchar_t, true>::~moneypunct()
     668    {
     669      if (_M_data->_M_positive_sign_size)
     670        delete [] _M_data->_M_positive_sign;
     671      if (_M_data->_M_negative_sign_size
     672          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
     673        delete [] _M_data->_M_negative_sign;
     674      if (_M_data->_M_curr_symbol_size)
     675        delete [] _M_data->_M_curr_symbol;
     676      delete _M_data;
     677    }
     678
     679  template<>
     680    moneypunct<wchar_t, false>::~moneypunct()
     681    {
     682      if (_M_data->_M_positive_sign_size)
     683        delete [] _M_data->_M_positive_sign;
     684      if (_M_data->_M_negative_sign_size
     685          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
     686        delete [] _M_data->_M_negative_sign;
     687      if (_M_data->_M_curr_symbol_size)
     688        delete [] _M_data->_M_curr_symbol;
     689      delete _M_data;
     690    }
     691#endif
     692}
  • libstdc++-v3/config/locale/uclibc/numeric_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
    old new  
     1// std::numpunct implementation details, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.3.1.2  numpunct virtual functions
     32//
     33
     34// Written by Benjamin Kosnik <bkoz@redhat.com>
     35
     36#define _LIBC
     37#include <locale>
     38#undef _LIBC
     39#include <bits/c++locale_internal.h>
     40
     41#ifdef __UCLIBC_MJN3_ONLY__
     42#warning tailor for stub locale support
     43#endif
     44#ifndef __UCLIBC_HAS_XLOCALE__
     45#define __nl_langinfo_l(N, L)         nl_langinfo((N))
     46#endif
     47
     48namespace std
     49{
     50  template<>
     51    void
     52    numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
     53    {
     54      if (!_M_data)
     55        _M_data = new __numpunct_cache<char>;
     56
     57      if (!__cloc)
     58        {
     59          // "C" locale
     60          _M_data->_M_grouping = "";
     61          _M_data->_M_grouping_size = 0;
     62          _M_data->_M_use_grouping = false;
     63
     64          _M_data->_M_decimal_point = '.';
     65          _M_data->_M_thousands_sep = ',';
     66
     67          for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
     68            _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
     69
     70          for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
     71            _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
     72        }
     73      else
     74        {
     75          // Named locale.
     76          _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
     77                                                        __cloc));
     78          _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
     79                                                        __cloc));
     80
     81          // Check for NULL, which implies no grouping.
     82          if (_M_data->_M_thousands_sep == '\0')
     83            _M_data->_M_grouping = "";
     84          else
     85            _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
     86          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
     87        }
     88
     89      // NB: There is no way to extact this info from posix locales.
     90      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
     91      _M_data->_M_truename = "true";
     92      _M_data->_M_truename_size = 4;
     93      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
     94      _M_data->_M_falsename = "false";
     95      _M_data->_M_falsename_size = 5;
     96    }
     97 
     98  template<>
     99    numpunct<char>::~numpunct()
     100    { delete _M_data; }
     101   
     102#ifdef _GLIBCXX_USE_WCHAR_T
     103  template<>
     104    void
     105    numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
     106    {
     107      if (!_M_data)
     108        _M_data = new __numpunct_cache<wchar_t>;
     109
     110      if (!__cloc)
     111        {
     112          // "C" locale
     113          _M_data->_M_grouping = "";
     114          _M_data->_M_grouping_size = 0;
     115          _M_data->_M_use_grouping = false;
     116
     117          _M_data->_M_decimal_point = L'.';
     118          _M_data->_M_thousands_sep = L',';
     119
     120          // Use ctype::widen code without the facet...
     121          for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
     122            _M_data->_M_atoms_out[__i] =
     123              static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
     124
     125          for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
     126            _M_data->_M_atoms_in[__j] =
     127              static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
     128        }
     129      else
     130        {
     131          // Named locale.
     132          // NB: In the GNU model wchar_t is always 32 bit wide.
     133#ifdef __UCLIBC_MJN3_ONLY__
     134#warning fix this
     135#endif
     136#ifdef __UCLIBC__
     137# ifdef __UCLIBC_HAS_XLOCALE__
     138          _M_data->_M_decimal_point = __cloc->decimal_point_wc;
     139          _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
     140# elif defined __UCLIBC_HAS_LOCALE__
     141          _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
     142          _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
     143# endif
     144#else
     145          union { char *__s; wchar_t __w; } __u;
     146          __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
     147          _M_data->_M_decimal_point = __u.__w;
     148
     149          __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
     150          _M_data->_M_thousands_sep = __u.__w;
     151#endif
     152
     153          if (_M_data->_M_thousands_sep == L'\0')
     154            _M_data->_M_grouping = "";
     155          else
     156            _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
     157          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
     158        }
     159
     160      // NB: There is no way to extact this info from posix locales.
     161      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
     162      _M_data->_M_truename = L"true";
     163      _M_data->_M_truename_size = 4;
     164      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
     165      _M_data->_M_falsename = L"false";
     166      _M_data->_M_falsename_size = 5;
     167    }
     168
     169  template<>
     170    numpunct<wchar_t>::~numpunct()
     171    { delete _M_data; }
     172 #endif
     173}
  • libstdc++-v3/config/locale/uclibc/time_members.cc

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.1.1/libstdc++-v3/config/locale/uclibc/time_members.cc
    old new  
     1// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
     32// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
     33//
     34
     35// Written by Benjamin Kosnik <bkoz@redhat.com>
     36
     37#include <locale>
     38#include <bits/c++locale_internal.h>
     39
     40#ifdef __UCLIBC_MJN3_ONLY__
     41#warning tailor for stub locale support
     42#endif
     43#ifndef __UCLIBC_HAS_XLOCALE__
     44#define __nl_langinfo_l(N, L)         nl_langinfo((N))
     45#endif
     46
     47namespace std
     48{
     49  template<>
     50    void
     51    __timepunct<char>::
     52    _M_put(char* __s, size_t __maxlen, const char* __format,
     53           const tm* __tm) const
     54    {
     55#ifdef __UCLIBC_HAS_XLOCALE__
     56      const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
     57                                        _M_c_locale_timepunct);
     58#else
     59      char* __old = strdup(setlocale(LC_ALL, NULL));
     60      setlocale(LC_ALL, _M_name_timepunct);
     61      const size_t __len = strftime(__s, __maxlen, __format, __tm);
     62      setlocale(LC_ALL, __old);
     63      free(__old);
     64#endif
     65      // Make sure __s is null terminated.
     66      if (__len == 0)
     67        __s[0] = '\0';
     68    }
     69
     70  template<>
     71    void
     72    __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
     73    {
     74      if (!_M_data)
     75        _M_data = new __timepunct_cache<char>;
     76
     77      if (!__cloc)
     78        {
     79          // "C" locale
     80          _M_c_locale_timepunct = _S_get_c_locale();
     81
     82          _M_data->_M_date_format = "%m/%d/%y";
     83          _M_data->_M_date_era_format = "%m/%d/%y";
     84          _M_data->_M_time_format = "%H:%M:%S";
     85          _M_data->_M_time_era_format = "%H:%M:%S";
     86          _M_data->_M_date_time_format = "";
     87          _M_data->_M_date_time_era_format = "";
     88          _M_data->_M_am = "AM";
     89          _M_data->_M_pm = "PM";
     90          _M_data->_M_am_pm_format = "";
     91
     92          // Day names, starting with "C"'s Sunday.
     93          _M_data->_M_day1 = "Sunday";
     94          _M_data->_M_day2 = "Monday";
     95          _M_data->_M_day3 = "Tuesday";
     96          _M_data->_M_day4 = "Wednesday";
     97          _M_data->_M_day5 = "Thursday";
     98          _M_data->_M_day6 = "Friday";
     99          _M_data->_M_day7 = "Saturday";
     100
     101          // Abbreviated day names, starting with "C"'s Sun.
     102          _M_data->_M_aday1 = "Sun";
     103          _M_data->_M_aday2 = "Mon";
     104          _M_data->_M_aday3 = "Tue";
     105          _M_data->_M_aday4 = "Wed";
     106          _M_data->_M_aday5 = "Thu";
     107          _M_data->_M_aday6 = "Fri";
     108          _M_data->_M_aday7 = "Sat";
     109
     110          // Month names, starting with "C"'s January.
     111          _M_data->_M_month01 = "January";
     112          _M_data->_M_month02 = "February";
     113          _M_data->_M_month03 = "March";
     114          _M_data->_M_month04 = "April";
     115          _M_data->_M_month05 = "May";
     116          _M_data->_M_month06 = "June";
     117          _M_data->_M_month07 = "July";
     118          _M_data->_M_month08 = "August";
     119          _M_data->_M_month09 = "September";
     120          _M_data->_M_month10 = "October";
     121          _M_data->_M_month11 = "November";
     122          _M_data->_M_month12 = "December";
     123
     124          // Abbreviated month names, starting with "C"'s Jan.
     125          _M_data->_M_amonth01 = "Jan";
     126          _M_data->_M_amonth02 = "Feb";
     127          _M_data->_M_amonth03 = "Mar";
     128          _M_data->_M_amonth04 = "Apr";
     129          _M_data->_M_amonth05 = "May";
     130          _M_data->_M_amonth06 = "Jun";
     131          _M_data->_M_amonth07 = "Jul";
     132          _M_data->_M_amonth08 = "Aug";
     133          _M_data->_M_amonth09 = "Sep";
     134          _M_data->_M_amonth10 = "Oct";
     135          _M_data->_M_amonth11 = "Nov";
     136          _M_data->_M_amonth12 = "Dec";
     137        }
     138      else
     139        {
     140          _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
     141
     142          _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
     143          _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
     144          _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
     145          _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
     146          _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
     147          _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
     148                                                             __cloc);
     149          _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
     150          _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
     151          _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
     152
     153          // Day names, starting with "C"'s Sunday.
     154          _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
     155          _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
     156          _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
     157          _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
     158          _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
     159          _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
     160          _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
     161
     162          // Abbreviated day names, starting with "C"'s Sun.
     163          _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
     164          _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
     165          _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
     166          _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
     167          _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
     168          _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
     169          _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
     170
     171          // Month names, starting with "C"'s January.
     172          _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
     173          _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
     174          _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
     175          _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
     176          _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
     177          _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
     178          _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
     179          _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
     180          _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
     181          _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
     182          _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
     183          _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
     184
     185          // Abbreviated month names, starting with "C"'s Jan.
     186          _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
     187          _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
     188          _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
     189          _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
     190          _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
     191          _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
     192          _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
     193          _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
     194          _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
     195          _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
     196          _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
     197          _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
     198        }
     199    }
     200
     201#ifdef _GLIBCXX_USE_WCHAR_T
     202  template<>
     203    void
     204    __timepunct<wchar_t>::
     205    _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
     206           const tm* __tm) const
     207    {
     208#ifdef __UCLIBC_HAS_XLOCALE__
     209      __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
     210      const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
     211                                        _M_c_locale_timepunct);
     212#else
     213      char* __old = strdup(setlocale(LC_ALL, NULL));
     214      setlocale(LC_ALL, _M_name_timepunct);
     215      const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
     216      setlocale(LC_ALL, __old);
     217      free(__old);
     218#endif
     219      // Make sure __s is null terminated.
     220      if (__len == 0)
     221        __s[0] = L'\0';
     222    }
     223
     224  template<>
     225    void
     226    __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
     227    {
     228      if (!_M_data)
     229        _M_data = new __timepunct_cache<wchar_t>;
     230
     231#warning wide time stuff
     232//       if (!__cloc)
     233        {
     234          // "C" locale
     235          _M_c_locale_timepunct = _S_get_c_locale();
     236
     237          _M_data->_M_date_format = L"%m/%d/%y";
     238          _M_data->_M_date_era_format = L"%m/%d/%y";
     239          _M_data->_M_time_format = L"%H:%M:%S";
     240          _M_data->_M_time_era_format = L"%H:%M:%S";
     241          _M_data->_M_date_time_format = L"";
     242          _M_data->_M_date_time_era_format = L"";
     243          _M_data->_M_am = L"AM";
     244          _M_data->_M_pm = L"PM";
     245          _M_data->_M_am_pm_format = L"";
     246
     247          // Day names, starting with "C"'s Sunday.
     248          _M_data->_M_day1 = L"Sunday";
     249          _M_data->_M_day2 = L"Monday";
     250          _M_data->_M_day3 = L"Tuesday";
     251          _M_data->_M_day4 = L"Wednesday";
     252          _M_data->_M_day5 = L"Thursday";
     253          _M_data->_M_day6 = L"Friday";
     254          _M_data->_M_day7 = L"Saturday";
     255
     256          // Abbreviated day names, starting with "C"'s Sun.
     257          _M_data->_M_aday1 = L"Sun";
     258          _M_data->_M_aday2 = L"Mon";
     259          _M_data->_M_aday3 = L"Tue";
     260          _M_data->_M_aday4 = L"Wed";
     261          _M_data->_M_aday5 = L"Thu";
     262          _M_data->_M_aday6 = L"Fri";
     263          _M_data->_M_aday7 = L"Sat";
     264
     265          // Month names, starting with "C"'s January.
     266          _M_data->_M_month01 = L"January";
     267          _M_data->_M_month02 = L"February";
     268          _M_data->_M_month03 = L"March";
     269          _M_data->_M_month04 = L"April";
     270          _M_data->_M_month05 = L"May";
     271          _M_data->_M_month06 = L"June";
     272          _M_data->_M_month07 = L"July";
     273          _M_data->_M_month08 = L"August";
     274          _M_data->_M_month09 = L"September";
     275          _M_data->_M_month10 = L"October";
     276          _M_data->_M_month11 = L"November";
     277          _M_data->_M_month12 = L"December";
     278
     279          // Abbreviated month names, starting with "C"'s Jan.
     280          _M_data->_M_amonth01 = L"Jan";
     281          _M_data->_M_amonth02 = L"Feb";
     282          _M_data->_M_amonth03 = L"Mar";
     283          _M_data->_M_amonth04 = L"Apr";
     284          _M_data->_M_amonth05 = L"May";
     285          _M_data->_M_amonth06 = L"Jun";
     286          _M_data->_M_amonth07 = L"Jul";
     287          _M_data->_M_amonth08 = L"Aug";
     288          _M_data->_M_amonth09 = L"Sep";
     289          _M_data->_M_amonth10 = L"Oct";
     290          _M_data->_M_amonth11 = L"Nov";
     291          _M_data->_M_amonth12 = L"Dec";
     292        }
     293#if 0
     294      else
     295        {
     296          _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
     297
     298          union { char *__s; wchar_t *__w; } __u;
     299
     300          __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
     301          _M_data->_M_date_format = __u.__w;
     302          __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
     303          _M_data->_M_date_era_format = __u.__w;
     304          __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
     305          _M_data->_M_time_format = __u.__w;
     306          __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
     307          _M_data->_M_time_era_format = __u.__w;
     308          __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
     309          _M_data->_M_date_time_format = __u.__w;
     310          __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
     311          _M_data->_M_date_time_era_format = __u.__w;
     312          __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
     313          _M_data->_M_am = __u.__w;
     314          __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
     315          _M_data->_M_pm = __u.__w;
     316          __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
     317          _M_data->_M_am_pm_format = __u.__w;
     318
     319          // Day names, starting with "C"'s Sunday.
     320          __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
     321          _M_data->_M_day1 = __u.__w;
     322          __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
     323          _M_data->_M_day2 = __u.__w;
     324          __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
     325          _M_data->_M_day3 = __u.__w;
     326          __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
     327          _M_data->_M_day4 = __u.__w;
     328          __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
     329          _M_data->_M_day5 = __u.__w;
     330          __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
     331          _M_data->_M_day6 = __u.__w;
     332          __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
     333          _M_data->_M_day7 = __u.__w;
     334
     335          // Abbreviated day names, starting with "C"'s Sun.
     336          __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
     337          _M_data->_M_aday1 = __u.__w;
     338          __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
     339          _M_data->_M_aday2 = __u.__w;
     340          __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
     341          _M_data->_M_aday3 = __u.__w;
     342          __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
     343          _M_data->_M_aday4 = __u.__w;
     344          __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
     345          _M_data->_M_aday5 = __u.__w;
     346          __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
     347          _M_data->_M_aday6 = __u.__w;
     348          __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
     349          _M_data->_M_aday7 = __u.__w;
     350
     351          // Month names, starting with "C"'s January.
     352          __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
     353          _M_data->_M_month01 = __u.__w;
     354          __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
     355          _M_data->_M_month02 = __u.__w;
     356          __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
     357          _M_data->_M_month03 = __u.__w;
     358          __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
     359          _M_data->_M_month04 = __u.__w;
     360          __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
     361          _M_data->_M_month05 = __u.__w;
     362          __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
     363          _M_data->_M_month06 = __u.__w;
     364          __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
     365          _M_data->_M_month07 = __u.__w;
     366          __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
     367          _M_data->_M_month08 = __u.__w;
     368          __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
     369          _M_data->_M_month09 = __u.__w;
     370          __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
     371          _M_data->_M_month10 = __u.__w;
     372          __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
     373          _M_data->_M_month11 = __u.__w;
     374          __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
     375          _M_data->_M_month12 = __u.__w;
     376
     377          // Abbreviated month names, starting with "C"'s Jan.
     378          __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
     379          _M_data->_M_amonth01 = __u.__w;
     380          __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
     381          _M_data->_M_amonth02 = __u.__w;
     382          __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
     383          _M_data->_M_amonth03 = __u.__w;
     384          __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
     385          _M_data->_M_amonth04 = __u.__w;
     386          __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
     387          _M_data->_M_amonth05 = __u.__w;
     388          __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
     389          _M_data->_M_amonth06 = __u.__w;
     390          __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
     391          _M_data->_M_amonth07 = __u.__w;
     392          __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
     393          _M_data->_M_amonth08 = __u.__w;
     394          __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
     395          _M_data->_M_amonth09 = __u.__w;
     396          __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
     397          _M_data->_M_amonth10 = __u.__w;
     398          __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
     399          _M_data->_M_amonth11 = __u.__w;
     400          __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
     401          _M_data->_M_amonth12 = __u.__w;
     402        }
     403#endif // 0
     404    }
     405#endif
     406}
  • libstdc++-v3/config/locale/uclibc/time_members.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.1.1/libstdc++-v3/config/locale/uclibc/time_members.h
    old new  
     1// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
     2
     3// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.2.5.1.2 - time_get functions
     32// ISO C++ 14882: 22.2.5.3.2 - time_put functions
     33//
     34
     35// Written by Benjamin Kosnik <bkoz@redhat.com>
     36
     37  template<typename _CharT>
     38    __timepunct<_CharT>::__timepunct(size_t __refs)
     39    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
     40      _M_name_timepunct(_S_get_c_name())
     41    { _M_initialize_timepunct(); }
     42
     43  template<typename _CharT>
     44    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
     45    : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
     46      _M_name_timepunct(_S_get_c_name())
     47    { _M_initialize_timepunct(); }
     48
     49  template<typename _CharT>
     50    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
     51                                     size_t __refs)
     52    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
     53      _M_name_timepunct(NULL)
     54    {
     55      const size_t __len = std::strlen(__s) + 1;
     56      char* __tmp = new char[__len];
     57      std::memcpy(__tmp, __s, __len);
     58      _M_name_timepunct = __tmp;
     59
     60      try
     61        { _M_initialize_timepunct(__cloc); }
     62      catch(...)
     63        {
     64          delete [] _M_name_timepunct;
     65          __throw_exception_again;
     66        }
     67    }
     68
     69  template<typename _CharT>
     70    __timepunct<_CharT>::~__timepunct()
     71    {
     72      if (_M_name_timepunct != _S_get_c_name())
     73        delete [] _M_name_timepunct;
     74      delete _M_data;
     75      _S_destroy_c_locale(_M_c_locale_timepunct);
     76    }
  • libstdc++-v3/config/os/uclibc/ctype_base.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.1.1/libstdc++-v3/config/os/uclibc/ctype_base.h
    old new  
     1// Locale support -*- C++ -*-
     2
     3// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
     4// Free Software Foundation, Inc.
     5//
     6// This file is part of the GNU ISO C++ Library.  This library is free
     7// software; you can redistribute it and/or modify it under the
     8// terms of the GNU General Public License as published by the
     9// Free Software Foundation; either version 2, or (at your option)
     10// any later version.
     11
     12// This library is distributed in the hope that it will be useful,
     13// but WITHOUT ANY WARRANTY; without even the implied warranty of
     14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15// GNU General Public License for more details.
     16
     17// You should have received a copy of the GNU General Public License along
     18// with this library; see the file COPYING.  If not, write to the Free
     19// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
     20// USA.
     21
     22// As a special exception, you may use this file as part of a free software
     23// library without restriction.  Specifically, if other files instantiate
     24// templates or use macros or inline functions from this file, or you compile
     25// this file and link it with other files to produce an executable, this
     26// file does not by itself cause the resulting executable to be covered by
     27// the GNU General Public License.  This exception does not however
     28// invalidate any other reasons why the executable file might be covered by
     29// the GNU General Public License.
     30
     31//
     32// ISO C++ 14882: 22.1  Locales
     33//
     34 
     35/** @file ctype_base.h
     36 *  This is an internal header file, included by other library headers.
     37 *  You should not attempt to use it directly.
     38 */
     39
     40// Information as gleaned from /usr/include/ctype.h
     41 
     42  /// @brief  Base class for ctype.
     43  struct ctype_base
     44  {
     45    // Note: In uClibc, the following two types depend on configuration.
     46 
     47    // Non-standard typedefs.
     48    typedef const __ctype_touplow_t* __to_type;
     49
     50    // NB: Offsets into ctype<char>::_M_table force a particular size
     51    // on the mask type. Because of this, we don't use an enum.
     52    typedef __ctype_mask_t      mask;   
     53    static const mask upper     = _ISupper;
     54    static const mask lower     = _ISlower;
     55    static const mask alpha     = _ISalpha;
     56    static const mask digit     = _ISdigit;
     57    static const mask xdigit    = _ISxdigit;
     58    static const mask space     = _ISspace;
     59    static const mask print     = _ISprint;
     60    static const mask graph     = _ISalpha | _ISdigit | _ISpunct;
     61    static const mask cntrl     = _IScntrl;
     62    static const mask punct     = _ISpunct;
     63    static const mask alnum     = _ISalpha | _ISdigit;
     64  };
  • libstdc++-v3/config/os/uclibc/ctype_inline.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.1.1/libstdc++-v3/config/os/uclibc/ctype_inline.h
    old new  
     1// Locale support -*- C++ -*-
     2
     3// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30//
     31// ISO C++ 14882: 22.1  Locales
     32//
     33 
     34// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
     35// functions go in ctype.cc
     36 
     37  bool
     38  ctype<char>::
     39  is(mask __m, char __c) const
     40  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
     41
     42  const char*
     43  ctype<char>::
     44  is(const char* __low, const char* __high, mask* __vec) const
     45  {
     46    while (__low < __high)
     47      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
     48    return __high;
     49  }
     50
     51  const char*
     52  ctype<char>::
     53  scan_is(mask __m, const char* __low, const char* __high) const
     54  {
     55    while (__low < __high
     56           && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
     57      ++__low;
     58    return __low;
     59  }
     60
     61  const char*
     62  ctype<char>::
     63  scan_not(mask __m, const char* __low, const char* __high) const
     64  {
     65    while (__low < __high
     66           && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
     67      ++__low;
     68    return __low;
     69  }
  • libstdc++-v3/config/os/uclibc/ctype_noninline.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.1.1/libstdc++-v3/config/os/uclibc/ctype_noninline.h
    old new  
     1// Locale support -*- C++ -*-
     2
     3// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
     4// Free Software Foundation, Inc.
     5//
     6// This file is part of the GNU ISO C++ Library.  This library is free
     7// software; you can redistribute it and/or modify it under the
     8// terms of the GNU General Public License as published by the
     9// Free Software Foundation; either version 2, or (at your option)
     10// any later version.
     11
     12// This library is distributed in the hope that it will be useful,
     13// but WITHOUT ANY WARRANTY; without even the implied warranty of
     14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15// GNU General Public License for more details.
     16
     17// You should have received a copy of the GNU General Public License along
     18// with this library; see the file COPYING.  If not, write to the Free
     19// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
     20// USA.
     21
     22// As a special exception, you may use this file as part of a free software
     23// library without restriction.  Specifically, if other files instantiate
     24// templates or use macros or inline functions from this file, or you compile
     25// this file and link it with other files to produce an executable, this
     26// file does not by itself cause the resulting executable to be covered by
     27// the GNU General Public License.  This exception does not however
     28// invalidate any other reasons why the executable file might be covered by
     29// the GNU General Public License.
     30
     31//
     32// ISO C++ 14882: 22.1  Locales
     33//
     34 
     35// Information as gleaned from /usr/include/ctype.h
     36
     37  const ctype_base::mask*
     38  ctype<char>::classic_table() throw()
     39  { return __C_ctype_b; }
     40
     41  ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
     42                     size_t __refs)
     43  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
     44  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
     45  {
     46    _M_toupper = __C_ctype_toupper;
     47    _M_tolower = __C_ctype_tolower;
     48    _M_table = __table ? __table : __C_ctype_b;
     49    memset(_M_widen, 0, sizeof(_M_widen));
     50    memset(_M_narrow, 0, sizeof(_M_narrow));
     51  }
     52
     53  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
     54  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
     55  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
     56  {
     57    _M_toupper = __C_ctype_toupper;
     58    _M_tolower = __C_ctype_tolower;
     59    _M_table = __table ? __table : __C_ctype_b;
     60    memset(_M_widen, 0, sizeof(_M_widen));
     61    memset(_M_narrow, 0, sizeof(_M_narrow));
     62  }
     63
     64  char
     65  ctype<char>::do_toupper(char __c) const
     66  { return _M_toupper[static_cast<unsigned char>(__c)]; }
     67
     68  const char*
     69  ctype<char>::do_toupper(char* __low, const char* __high) const
     70  {
     71    while (__low < __high)
     72      {
     73        *__low = _M_toupper[static_cast<unsigned char>(*__low)];
     74        ++__low;
     75      }
     76    return __high;
     77  }
     78
     79  char
     80  ctype<char>::do_tolower(char __c) const
     81  { return _M_tolower[static_cast<unsigned char>(__c)]; }
     82
     83  const char*
     84  ctype<char>::do_tolower(char* __low, const char* __high) const
     85  {
     86    while (__low < __high)
     87      {
     88        *__low = _M_tolower[static_cast<unsigned char>(*__low)];
     89        ++__low;
     90      }
     91    return __high;
     92  }
  • libstdc++-v3/config/os/uclibc/os_defines.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.1.1/libstdc++-v3/config/os/uclibc/os_defines.h
    old new  
     1// Specific definitions for GNU/Linux  -*- C++ -*-
     2
     3// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
     4//
     5// This file is part of the GNU ISO C++ Library.  This library is free
     6// software; you can redistribute it and/or modify it under the
     7// terms of the GNU General Public License as published by the
     8// Free Software Foundation; either version 2, or (at your option)
     9// any later version.
     10
     11// This library is distributed in the hope that it will be useful,
     12// but WITHOUT ANY WARRANTY; without even the implied warranty of
     13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14// GNU General Public License for more details.
     15
     16// You should have received a copy of the GNU General Public License along
     17// with this library; see the file COPYING.  If not, write to the Free
     18// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
     19// USA.
     20
     21// As a special exception, you may use this file as part of a free software
     22// library without restriction.  Specifically, if other files instantiate
     23// templates or use macros or inline functions from this file, or you compile
     24// this file and link it with other files to produce an executable, this
     25// file does not by itself cause the resulting executable to be covered by
     26// the GNU General Public License.  This exception does not however
     27// invalidate any other reasons why the executable file might be covered by
     28// the GNU General Public License.
     29
     30#ifndef _GLIBCXX_OS_DEFINES
     31#define _GLIBCXX_OS_DEFINES 1
     32
     33// System-specific #define, typedefs, corrections, etc, go here.  This
     34// file will come before all others.
     35
     36// This keeps isanum, et al from being propagated as macros.
     37#define __NO_CTYPE 1
     38
     39#include <features.h>
     40
     41// We must not see the optimized string functions GNU libc defines.
     42#define __NO_STRING_INLINES
     43
     44#endif
  • libstdc++-v3/configure

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/configure gcc-4.1.1/libstdc++-v3/configure
    old new  
    40054005  lt_cv_deplibs_check_method=pass_all
    40064006  ;;
    40074007
     4008linux-uclibc*)
     4009  lt_cv_deplibs_check_method=pass_all
     4010  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     4011  ;;
     4012
    40084013netbsd* | knetbsd*-gnu)
    40094014  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    40104015    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
     
    57405745  enableval="$enable_clocale"
    57415746
    57425747      case "$enableval" in
    5743        generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
     5748       generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
    57445749       *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
    57455750echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
    57465751   { (exit 1); exit 1; }; } ;;
     
    57655770  # Default to "generic".
    57665771  if test $enable_clocale_flag = auto; then
    57675772    case ${target_os} in
     5773      linux-uclibc*)
     5774        enable_clocale_flag=uclibc
     5775        ;;
    57685776      linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
    57695777        cat >conftest.$ac_ext <<_ACEOF
    57705778/* confdefs.h.  */
     
    59956003      CTIME_CC=config/locale/generic/time_members.cc
    59966004      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
    59976005      ;;
     6006    uclibc)
     6007      echo "$as_me:$LINENO: result: uclibc" >&5
     6008echo "${ECHO_T}uclibc" >&6
     6009
     6010      # Declare intention to use gettext, and add support for specific
     6011      # languages.
     6012      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
     6013      ALL_LINGUAS="de fr"
     6014
     6015      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
     6016      # Extract the first word of "msgfmt", so it can be a program name with args.
     6017set dummy msgfmt; ac_word=$2
     6018echo "$as_me:$LINENO: checking for $ac_word" >&5
     6019echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
     6020if test "${ac_cv_prog_check_msgfmt+set}" = set; then
     6021  echo $ECHO_N "(cached) $ECHO_C" >&6
     6022else
     6023  if test -n "$check_msgfmt"; then
     6024  ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
     6025else
     6026as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
     6027for as_dir in $PATH
     6028do
     6029  IFS=$as_save_IFS
     6030  test -z "$as_dir" && as_dir=.
     6031  for ac_exec_ext in '' $ac_executable_extensions; do
     6032  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     6033    ac_cv_prog_check_msgfmt="yes"
     6034    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     6035    break 2
     6036  fi
     6037done
     6038done
     6039
     6040  test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
     6041fi
     6042fi
     6043check_msgfmt=$ac_cv_prog_check_msgfmt
     6044if test -n "$check_msgfmt"; then
     6045  echo "$as_me:$LINENO: result: $check_msgfmt" >&5
     6046echo "${ECHO_T}$check_msgfmt" >&6
     6047else
     6048  echo "$as_me:$LINENO: result: no" >&5
     6049echo "${ECHO_T}no" >&6
     6050fi
     6051
     6052      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
     6053        USE_NLS=yes
     6054      fi
     6055      # Export the build objects.
     6056      for ling in $ALL_LINGUAS; do \
     6057        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
     6058        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
     6059      done
     6060
     6061
     6062
     6063      CLOCALE_H=config/locale/uclibc/c_locale.h
     6064      CLOCALE_CC=config/locale/uclibc/c_locale.cc
     6065      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
     6066      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
     6067      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
     6068      CMESSAGES_H=config/locale/uclibc/messages_members.h
     6069      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
     6070      CMONEY_CC=config/locale/uclibc/monetary_members.cc
     6071      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
     6072      CTIME_H=config/locale/uclibc/time_members.h
     6073      CTIME_CC=config/locale/uclibc/time_members.cc
     6074      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
     6075      ;;
    59986076  esac
    59996077
    60006078  # This is where the testsuite looks for locale catalogs, using the
     
    72467324cat >>conftest.$ac_ext <<_ACEOF
    72477325/* end confdefs.h.  */
    72487326#include <complex.h>
     7327#ifdef __UCLIBC__
     7328#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
     7329#endif
    72497330int
    72507331main ()
    72517332{
  • libstdc++-v3/configure.host

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/configure.host gcc-4.1.1/libstdc++-v3/configure.host
    old new  
    261261    ;;
    262262esac
    263263
     264# Override for uClibc since linux-uclibc gets mishandled above.
     265case "${host_os}" in
     266  *-uclibc*)
     267    os_include_dir="os/uclibc"
     268    ;;
     269esac
    264270
    265271# Set any OS-dependent and CPU-dependent bits.
    266272# THIS TABLE IS SORTED.  KEEP IT THAT WAY.
  • libstdc++-v3/crossconfig.m4

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/crossconfig.m4 gcc-4.1.1/libstdc++-v3/crossconfig.m4
    old new  
    143143        ;;
    144144    esac
    145145    ;;
     146  *-uclibc*)
     147# Temporary hack until we implement the float versions of the libm funcs
     148    AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
     149      machine/endian.h machine/param.h sys/machine.h sys/types.h \
     150      fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
     151    SECTION_FLAGS='-ffunction-sections -fdata-sections'
     152    AC_SUBST(SECTION_FLAGS)
     153    GLIBCXX_CHECK_LINKER_FEATURES
     154    GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
     155    GLIBCXX_CHECK_WCHAR_T_SUPPORT
     156
     157    # For LFS.
     158    AC_DEFINE(HAVE_INT64_T)
     159    case "$target" in
     160      *-uclinux*)
     161        # Don't enable LFS with uClinux
     162        ;;
     163      *)
     164        AC_DEFINE(_GLIBCXX_USE_LFS)
     165    esac
     166
     167    # For showmanyc_helper().
     168    AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
     169    GLIBCXX_CHECK_POLL
     170    GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
     171
     172    # For xsputn_2().
     173    AC_CHECK_HEADERS(sys/uio.h)
     174    GLIBCXX_CHECK_WRITEV
     175
     176#     AC_DEFINE(HAVE_ACOSF)
     177#     AC_DEFINE(HAVE_ASINF)
     178#     AC_DEFINE(HAVE_ATANF)
     179#     AC_DEFINE(HAVE_ATAN2F)
     180    AC_DEFINE(HAVE_CEILF)
     181    AC_DEFINE(HAVE_COPYSIGN)
     182#     AC_DEFINE(HAVE_COPYSIGNF)
     183#     AC_DEFINE(HAVE_COSF)
     184#     AC_DEFINE(HAVE_COSHF)
     185#     AC_DEFINE(HAVE_EXPF)
     186#     AC_DEFINE(HAVE_FABSF)
     187    AC_DEFINE(HAVE_FINITE)
     188    AC_DEFINE(HAVE_FINITEF)
     189    AC_DEFINE(HAVE_FLOORF)
     190#     AC_DEFINE(HAVE_FMODF)
     191#     AC_DEFINE(HAVE_FREXPF)
     192    AC_DEFINE(HAVE_HYPOT)
     193#     AC_DEFINE(HAVE_HYPOTF)
     194    AC_DEFINE(HAVE_ISINF)
     195    AC_DEFINE(HAVE_ISINFF)
     196    AC_DEFINE(HAVE_ISNAN)
     197    AC_DEFINE(HAVE_ISNANF)
     198#     AC_DEFINE(HAVE_LOGF)
     199#     AC_DEFINE(HAVE_LOG10F)
     200#     AC_DEFINE(HAVE_MODFF)
     201#     AC_DEFINE(HAVE_SINF)
     202#     AC_DEFINE(HAVE_SINHF)
     203#     AC_DEFINE(HAVE_SINCOS)
     204#     AC_DEFINE(HAVE_SINCOSF)
     205    AC_DEFINE(HAVE_SQRTF)
     206#     AC_DEFINE(HAVE_TANF)
     207#     AC_DEFINE(HAVE_TANHF)
     208    if test x"long_double_math_on_this_cpu" = x"yes"; then
     209      AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
     210#       AC_DEFINE(HAVE_ACOSL)
     211#       AC_DEFINE(HAVE_ASINL)
     212#       AC_DEFINE(HAVE_ATANL)
     213#       AC_DEFINE(HAVE_ATAN2L)
     214#       AC_DEFINE(HAVE_CEILL)
     215#       AC_DEFINE(HAVE_COPYSIGNL)
     216#       AC_DEFINE(HAVE_COSL)
     217#       AC_DEFINE(HAVE_COSHL)
     218#       AC_DEFINE(HAVE_EXPL)
     219#       AC_DEFINE(HAVE_FABSL)
     220#       AC_DEFINE(HAVE_FINITEL)
     221#       AC_DEFINE(HAVE_FLOORL)
     222#       AC_DEFINE(HAVE_FMODL)
     223#       AC_DEFINE(HAVE_FREXPL)
     224#       AC_DEFINE(HAVE_HYPOTL)
     225#       AC_DEFINE(HAVE_ISINFL)
     226#       AC_DEFINE(HAVE_ISNANL)
     227#       AC_DEFINE(HAVE_LOGL)
     228#       AC_DEFINE(HAVE_LOG10L)
     229#       AC_DEFINE(HAVE_MODFL)
     230#       AC_DEFINE(HAVE_POWL)
     231#       AC_DEFINE(HAVE_SINL)
     232#       AC_DEFINE(HAVE_SINHL)
     233#       AC_DEFINE(HAVE_SINCOSL)
     234#       AC_DEFINE(HAVE_SQRTL)
     235#       AC_DEFINE(HAVE_TANL)
     236#       AC_DEFINE(HAVE_TANHL)
     237    fi
     238    ;;
    146239  *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
    147240    AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
    148241      machine/endian.h machine/param.h sys/machine.h sys/types.h \
     
    157250    AC_DEFINE(HAVE_INT64_T)
    158251    case "$target" in
    159252      *-uclinux*)
    160         # Don't enable LFS with uClibc
     253        # Don't enable LFS with uClinux
    161254        ;;
    162255      *)
    163256        AC_DEFINE(_GLIBCXX_USE_LFS)
  • libstdc++-v3/include/c_compatibility/wchar.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.1.1/libstdc++-v3/include/c_compatibility/wchar.h
    old new  
    101101using std::wmemcpy;
    102102using std::wmemmove;
    103103using std::wmemset;
     104#if _GLIBCXX_HAVE_WCSFTIME
    104105using std::wcsftime;
     106#endif
    105107
    106108#if _GLIBCXX_USE_C99
    107109using std::wcstold;
  • libstdc++-v3/include/c_std/std_cstdio.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.1.1/libstdc++-v3/include/c_std/std_cstdio.h
    old new  
    143143  using ::vsprintf;
    144144}
    145145
    146 #if _GLIBCXX_USE_C99
     146#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
    147147
    148148#undef snprintf
    149149#undef vfscanf
  • libstdc++-v3/include/c_std/std_cwchar.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.1.1/libstdc++-v3/include/c_std/std_cwchar.h
    old new  
    180180  using ::wcscoll;
    181181  using ::wcscpy;
    182182  using ::wcscspn;
     183#if _GLIBCXX_HAVE_WCSFTIME
    183184  using ::wcsftime;
     185#endif
    184186  using ::wcslen;
    185187  using ::wcsncat;
    186188  using ::wcsncmp;
  • libstdc++-v3/include/ext/rope

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/include/ext/rope gcc-4.1.1/libstdc++-v3/include/ext/rope
    old new  
    5757#include <bits/allocator.h>
    5858#include <ext/hash_fun.h>
    5959
     60/* cope w/ index defined as macro, SuSv3 proposal */
     61#undef index
     62
    6063# ifdef __GC
    6164#   define __GC_CONST const
    6265# else
  • libstdc++-v3/include/ext/ropeimpl.h

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.1.1/libstdc++-v3/include/ext/ropeimpl.h
    old new  
    5353#include <ext/memory> // For uninitialized_copy_n
    5454#include <ext/numeric> // For power
    5555
     56/* cope w/ index defined as macro, SuSv3 proposal */
     57#undef index
     58
    5659namespace __gnu_cxx
    5760{
    5861  using std::size_t;
  • libstdc++-v3/src/Makefile.am

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/src/Makefile.am gcc-4.1.1/libstdc++-v3/src/Makefile.am
    old new  
    234234          $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
    235235
    236236
     237install-exec-local:
     238ifeq ($(enable_shared),yes)
     239        $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
     240        $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
     241endif
     242
    237243# Added bits to build debug library.
    238244if GLIBCXX_BUILD_DEBUG
    239245all-local: build_debug
  • libstdc++-v3/src/Makefile.in

    diff -Naur gcc-4.1.1.orig/libstdc++-v3/src/Makefile.in gcc-4.1.1/libstdc++-v3/src/Makefile.in
    old new  
    627627
    628628install-data-am: install-data-local
    629629
    630 install-exec-am: install-toolexeclibLTLIBRARIES
     630install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
    631631
    632632install-info: install-info-am
    633633
     
    660660        distclean-libtool distclean-tags distdir dvi dvi-am html \
    661661        html-am info info-am install install-am install-data \
    662662        install-data-am install-data-local install-exec \
     663        install-exec-local \
    663664        install-exec-am install-info install-info-am install-man \
    664665        install-strip install-toolexeclibLTLIBRARIES installcheck \
    665666        installcheck-am installdirs maintainer-clean \
     
    760761install_debug:
    761762        (cd ${debugdir} && $(MAKE) \
    762763        toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
     764
     765install-exec-local:
     766ifeq ($(enable_shared),yes)
     767        $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
     768        $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
     769endif
     770
    763771# Tell versions [3.59,3.63) of GNU make to not export all variables.
    764772# Otherwise a system limit (for SysV at least) may be exceeded.
    765773.NOEXPORT:
  • libtool.m4

    diff -Naur gcc-4.1.1.orig/libtool.m4 gcc-4.1.1/libtool.m4
    old new  
    743743  lt_cv_deplibs_check_method=pass_all
    744744  ;;
    745745
     746linux-uclibc*)
     747  lt_cv_deplibs_check_method=pass_all
     748  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     749  ;;
     750
    746751netbsd* | knetbsd*-gnu)
    747752  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    748753    [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
  • ltconfig

    diff -Naur gcc-4.1.1.orig/ltconfig gcc-4.1.1/ltconfig
    old new  
    603603
    604604# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
    605605case $host_os in
     606linux-uclibc*) ;;
    606607linux-gnu*) ;;
    607608linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
    608609esac
     
    12741275  dynamic_linker='GNU/Linux ld.so'
    12751276  ;;
    12761277
     1278linux-uclibc*)
     1279  version_type=linux
     1280  need_lib_prefix=no
     1281  need_version=no
     1282  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
     1283  soname_spec='${libname}${release}.so$major'
     1284  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
     1285  shlibpath_var=LD_LIBRARY_PATH
     1286  shlibpath_overrides_runpath=no
     1287  # This implies no fast_install, which is unacceptable.
     1288  # Some rework will be needed to allow for fast_install
     1289  # before this can be enabled.
     1290  hardcode_into_libs=yes
     1291  # Assume using the uClibc dynamic linker.
     1292  dynamic_linker="uClibc ld.so"
     1293  ;;
     1294
    12771295netbsd*)
    12781296  need_lib_prefix=no
    12791297  need_version=no
  • zlib/configure

    diff -Naur gcc-4.1.1.orig/zlib/configure gcc-4.1.1/zlib/configure
    old new  
    34263426  lt_cv_deplibs_check_method=pass_all
    34273427  ;;
    34283428
     3429linux-uclibc*)
     3430  lt_cv_deplibs_check_method=pass_all
     3431  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
     3432  ;;
     3433
    34293434netbsd* | knetbsd*-gnu)
    34303435  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
    34313436    lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
Note: See TracBrowser for help on using the repository browser.