Re: fix for strict-alias warnings

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: fix for strict-alias warnings
Дата
Msg-id 200310111955.h9BJtMK10256@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: fix for strict-alias warnings  ("Andrew Dunstan" <andrew@dunslane.net>)
Список pgsql-patches
Andrew Dunstan wrote:
> >   The proc.c cases were using MemSet, which was checking if the
> > int* as aligned for int* access.  In fact, we could change MemSet to
> > always take a void *, and do the int* casting when we access it after
> > testing for alignment.
> >
>
> Since MemSet is generic, that is probably a good idea.

I have applied the following patch to add an additional void* cast to
MemSet, and added a comment that this was safe because alignment is
checked below --- patch attached.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/c.h,v
retrieving revision 1.153
diff -c -c -r1.153 c.h
*** src/include/c.h    21 Sep 2003 17:57:21 -0000    1.153
--- src/include/c.h    11 Oct 2003 19:51:09 -0000
***************
*** 604,610 ****
  #define MemSet(start, val, len) \
      do \
      { \
!         int32 * _start = (int32 *) (start); \
          int        _val = (val); \
          Size    _len = (len); \
  \
--- 604,611 ----
  #define MemSet(start, val, len) \
      do \
      { \
!         /* (void *) used because we check for alignment below */ \
!         int32 * _start = (int32 *) (void *) (start); \
          int        _val = (val); \
          Size    _len = (len); \
  \

В списке pgsql-patches по дате отправления:

Предыдущее
От: "Andrew Dunstan"
Дата:
Сообщение: Re: fix for strict-alias warnings
Следующее
От: "veramente@libero.it"
Дата:
Сообщение: libpq Italian Version first translation