aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2016-09-20 08:30:17 -0700
committerPaul Eggert2016-09-20 08:32:15 -0700
commitd9741b61c8e446de084cc4dc609aaa8e5702118d (patch)
treebc7dee77f208e70918e0c15aa91eb728f27b0c47 /src
parent83fbb3a6dd75e01a768cb6b3348b7c947711ee46 (diff)
downloademacs-d9741b61c8e446de084cc4dc609aaa8e5702118d.tar.gz
emacs-d9741b61c8e446de084cc4dc609aaa8e5702118d.zip
Use flexmembers on IBM XL C for AIX
This removes a workaround where Emacs did not use flexible array members when compiled with IBM XL C. Instead, avoid the problem by making the aliasing issues more obvious to this compiler. * admin/merge-gnulib: Don’t remove m4/flexmember.m4. * m4/flexmember.m4: Copy from gnulib. * configure.ac (AC_C_FLEXIBLE_ARRAY_MEMBER): Remove workaround. * src/alloc.c (allocate_string_data): Rephrase to avoid aliasing problem that would otherwise mess up code generated for flexible array members by IBM XL C for AIX, V12.1. * src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Remove; now done by gnulib code.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c16
-rw-r--r--src/conf_post.h10
2 files changed, 9 insertions, 17 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 1092a34801a..41b2f9e77d2 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2002,9 +2002,9 @@ allocate_string_data (struct Lisp_String *s,
2002 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 2002 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
2003#endif 2003#endif
2004 2004
2005 b->next_free = b->data; 2005 data = b->data;
2006 b->data[0].string = NULL;
2007 b->next = large_sblocks; 2006 b->next = large_sblocks;
2007 b->next_free = data;
2008 large_sblocks = b; 2008 large_sblocks = b;
2009 } 2009 }
2010 else if (current_sblock == NULL 2010 else if (current_sblock == NULL
@@ -2014,9 +2014,9 @@ allocate_string_data (struct Lisp_String *s,
2014 { 2014 {
2015 /* Not enough room in the current sblock. */ 2015 /* Not enough room in the current sblock. */
2016 b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); 2016 b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP);
2017 b->next_free = b->data; 2017 data = b->data;
2018 b->data[0].string = NULL;
2019 b->next = NULL; 2018 b->next = NULL;
2019 b->next_free = data;
2020 2020
2021 if (current_sblock) 2021 if (current_sblock)
2022 current_sblock->next = b; 2022 current_sblock->next = b;
@@ -2025,14 +2025,16 @@ allocate_string_data (struct Lisp_String *s,
2025 current_sblock = b; 2025 current_sblock = b;
2026 } 2026 }
2027 else 2027 else
2028 b = current_sblock; 2028 {
2029 b = current_sblock;
2030 data = b->next_free;
2031 }
2029 2032
2030 data = b->next_free; 2033 data->string = s;
2031 b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA); 2034 b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA);
2032 2035
2033 MALLOC_UNBLOCK_INPUT; 2036 MALLOC_UNBLOCK_INPUT;
2034 2037
2035 data->string = s;
2036 s->data = SDATA_DATA (data); 2038 s->data = SDATA_DATA (data);
2037#ifdef GC_CHECK_STRING_BYTES 2039#ifdef GC_CHECK_STRING_BYTES
2038 SDATA_NBYTES (data) = nbytes; 2040 SDATA_NBYTES (data) = nbytes;
diff --git a/src/conf_post.h b/src/conf_post.h
index 865d0183a57..6d54524b970 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -358,16 +358,6 @@ extern int emacs_setenv_TZ (char const *);
358#define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN 358#define INLINE_HEADER_BEGIN _GL_INLINE_HEADER_BEGIN
359#define INLINE_HEADER_END _GL_INLINE_HEADER_END 359#define INLINE_HEADER_END _GL_INLINE_HEADER_END
360 360
361/* To use the struct hack with N elements, declare the struct like this:
362 struct s { ...; t name[FLEXIBLE_ARRAY_MEMBER]; };
363 and allocate (offsetof (struct s, name) + N * sizeof (t)) bytes.
364 IBM xlc 12.1 claims to do C99 but mishandles flexible array members. */
365#ifdef __IBMC__
366# define FLEXIBLE_ARRAY_MEMBER 1
367#else
368# define FLEXIBLE_ARRAY_MEMBER
369#endif
370
371/* 'int x UNINIT;' is equivalent to 'int x;', except it cajoles GCC 361/* 'int x UNINIT;' is equivalent to 'int x;', except it cajoles GCC
372 into not warning incorrectly about use of an uninitialized variable. */ 362 into not warning incorrectly about use of an uninitialized variable. */
373#if defined GCC_LINT || defined lint 363#if defined GCC_LINT || defined lint