]> code.delx.au - gnu-emacs/commitdiff
Port to strict C99 offsetof
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Mar 2016 15:42:15 +0000 (08:42 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Mar 2016 15:43:32 +0000 (08:43 -0700)
* src/bidi.c (bidi_copy_it):
* src/lisp.h (CHAR_TABLE_EXTRA_SLOTS):
Use only a single identifier as the second argument of offsetof.
Found by using clang -pedantic.

src/bidi.c
src/lisp.h

index a68ffdb7e6dae45b175101074d4d3374cb4878ef..c23ff954356cbf53a32a52d9f4b9f854dbfa10f1 100644 (file)
@@ -532,7 +532,7 @@ bidi_copy_it (struct bidi_it *to, struct bidi_it *from)
   /* Copy everything from the start through the active part of
      the level stack.  */
   memcpy (to, from,
-         (offsetof (struct bidi_it, level_stack[1])
+         (offsetof (struct bidi_it, level_stack) + sizeof from->level_stack[0]
           + from->stack_idx * sizeof from->level_stack[0]));
 }
 
index 27588848c29fe26f757754109bb07d2d5ce03e5b..6a98adbda9c630fd01afafb29c13cc2c838af4d9 100644 (file)
@@ -1766,7 +1766,8 @@ CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct)
 
 /* Make sure that sub char-table contents slot is where we think it is.  */
 verify (offsetof (struct Lisp_Sub_Char_Table, contents)
-       == offsetof (struct Lisp_Vector, contents[SUB_CHAR_TABLE_OFFSET]));
+       == (offsetof (struct Lisp_Vector, contents)
+           + SUB_CHAR_TABLE_OFFSET * sizeof (Lisp_Object)));
 
 /***********************************************************************
                               Symbols