obstack: port --enable-gcc-warnings to clang
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 15 May 2013 07:27:15 +0000 (00:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 15 May 2013 07:33:38 +0000 (00:33 -0700)
* lib/obstack.h (obstack_ptr_grow_fast, obstack_int_grow_fast):
Avoid casts from looser to stricter-aligned pointers.

ChangeLog
lib/obstack.h

index f637cda..35a57b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2013-05-15  Paul Eggert  <eggert@cs.ucla.edu>
 
+       obstack: port --enable-gcc-warnings to clang
+       * lib/obstack.h (obstack_ptr_grow_fast, obstack_int_grow_fast):
+       Avoid casts from looser to stricter-aligned pointers.
+
        memchr2: port --enable-gcc-warnings to clang
        * lib/memchr2.c (memchr2):
        Avoid casts from looser to stricter-aligned pointers.
index 159cfa2..7cf98ed 100644 (file)
@@ -342,14 +342,16 @@ __extension__                                                           \
 # define obstack_ptr_grow_fast(OBSTACK,aptr)                            \
 __extension__                                                           \
 ({ struct obstack *__o1 = (OBSTACK);                                    \
-   *(const void **) __o1->next_free = (aptr);                           \
+   void *__p1 = __o1->next_free;                                        \
+   *(const void **) __p1 = (aptr);                                      \
    __o1->next_free += sizeof (const void *);                            \
    (void) 0; })
 
 # define obstack_int_grow_fast(OBSTACK,aint)                            \
 __extension__                                                           \
 ({ struct obstack *__o1 = (OBSTACK);                                    \
-   *(int *) __o1->next_free = (aint);                                   \
+   void *__p1 = __o1->next_free;                                        \
+   *(int *) __p1 = (aint);                                              \
    __o1->next_free += sizeof (int);                                     \
    (void) 0; })