From f70d9ae6adc6ed7952806056349ba9f8ba3c65c8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 31 Mar 2017 11:00:42 +0200 Subject: Use enum __packed in favour of -fshort-enums Some architectures like ARM encode the short enum option state in the object file and the linker checks that this option is consistent for all objects of an executable. In case applications use -fno-short-enums, then this leads to linker warnings. Use the enum __packed attribute for the relevent enums to avoid the -fshort-enums compiler option. This attribute is at least available on GCC, LLVM/clang and the Intel compiler. Signed-off-by: Sebastian Huber --- newlib/libc/stdlib/Makefile.am | 2 -- newlib/libc/stdlib/Makefile.in | 2 -- newlib/libc/stdlib/mbtowc_r.c | 6 +++--- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'newlib/libc/stdlib') diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am index 2d45d1029..fb2e44e42 100644 --- a/newlib/libc/stdlib/Makefile.am +++ b/newlib/libc/stdlib/Makefile.am @@ -307,8 +307,6 @@ $(lpfx)dtoa.$(oext): dtoa.c mprec.h $(lpfx)ldtoa.$(oext): ldtoa.c mprec.h $(lpfx)ecvtbuf.$(oext): ecvtbuf.c mprec.h $(lpfx)mbtowc_r.$(oext): mbtowc_r.c mbctype.h - $(LIB_COMPILE) -c -fshort-enums $(srcdir)/mbtowc_r.c -o $@ - $(lpfx)mprec.$(oext): mprec.c mprec.h $(lpfx)strtod.$(oext): strtod.c mprec.h $(lpfx)gdtoa-gethex.$(oext): gdtoa-gethex.c mprec.h diff --git a/newlib/libc/stdlib/Makefile.in b/newlib/libc/stdlib/Makefile.in index 466ab6d1e..b4b70b42b 100644 --- a/newlib/libc/stdlib/Makefile.in +++ b/newlib/libc/stdlib/Makefile.in @@ -1560,8 +1560,6 @@ $(lpfx)dtoa.$(oext): dtoa.c mprec.h $(lpfx)ldtoa.$(oext): ldtoa.c mprec.h $(lpfx)ecvtbuf.$(oext): ecvtbuf.c mprec.h $(lpfx)mbtowc_r.$(oext): mbtowc_r.c mbctype.h - $(LIB_COMPILE) -c -fshort-enums $(srcdir)/mbtowc_r.c -o $@ - $(lpfx)mprec.$(oext): mprec.c mprec.h $(lpfx)strtod.$(oext): strtod.c mprec.h $(lpfx)gdtoa-gethex.$(oext): gdtoa-gethex.c mprec.h diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index 116b4d82f..9d782566f 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -55,11 +55,11 @@ _DEFUN (__ascii_mbtowc, (r, pwc, s, n, state), } #ifdef _MB_CAPABLE -typedef enum { ESCAPE, DOLLAR, BRACKET, AT, B, J, +typedef enum __packed { ESCAPE, DOLLAR, BRACKET, AT, B, J, NUL, JIS_CHAR, OTHER, JIS_C_NUM } JIS_CHAR_TYPE; -typedef enum { ASCII, JIS, A_ESC, A_ESC_DL, JIS_1, J_ESC, J_ESC_BR, +typedef enum __packed { ASCII, JIS, A_ESC, A_ESC_DL, JIS_1, J_ESC, J_ESC_BR, INV, JIS_S_NUM } JIS_STATE; -typedef enum { COPY_A, COPY_J1, COPY_J2, MAKE_A, NOOP, EMPTY, ERROR } JIS_ACTION; +typedef enum __packed { COPY_A, COPY_J1, COPY_J2, MAKE_A, NOOP, EMPTY, ERROR } JIS_ACTION; /************************************************************************************** * state/action tables for processing JIS encoding -- cgit v1.2.3