ArcticaProject / nx-libs

nx-libs
Other
120 stars 39 forks source link

in libNX_X11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] #407

Open sunweaver opened 7 years ago

sunweaver commented 7 years ago
gcc -c -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/mike/MyDocuments/4projects/arctica-upstream/nx-libs.upstream/nx-libs.36=. -fstack-protector-strong -Wformat -Werror=format-security -g -std=c99 -Wall -Wpedantic -Wpointer-arith -Wundef    -I../.. -I../../exports/include   -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L              -D_POSIX_SOURCE -D_XOPEN_SOURCE                 -D_DEFAULT_SOURCE                                 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64                 -D_GNU_SOURCE                -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API    -DMALLOC_0_RETURNS_NULL  -DHAS_SNPRINTF -DLIBX11            -DPOSTLOCALELIBDIR=\"lib\" -I../../../nxcomp -DNX_TRANS_SOCKET              -DNX_TRANS_EXIT -DXCMS -DUSE_XCB=0  -DHAS_SHM -DXF86BIGFONT   -fPIC Font.c
Font.c: In function '_XQueryFont':
Font.c:235:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     fs->min_bounds = * (XCharStruct *) &reply.minBounds;
     ^~
Font.c:236:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     fs->max_bounds = * (XCharStruct *) &reply.maxBounds;
     ^~
Font.c: In function '_XF86BigfontQueryFont':
Font.c:479:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     fs->min_bounds = * (XCharStruct *) &reply.minBounds;
     ^~
Font.c:480:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     fs->max_bounds = * (XCharStruct *) &reply.maxBounds;
     ^~
[...]
gcc -c -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/mike/MyDocuments/4projects/arctica-upstream/nx-libs.upstream/nx-libs.36=. -fstack-protector-strong -Wformat -Werror=format-security -g -std=c99 -Wall -Wpedantic -Wpointer-arith -Wundef    -I../.. -I../../exports/include   -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L              -D_POSIX_SOURCE -D_XOPEN_SOURCE                 -D_DEFAULT_SOURCE                                 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64                 -D_GNU_SOURCE                -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API    -DMALLOC_0_RETURNS_NULL  -DHAS_SNPRINTF -DLIBX11            -DPOSTLOCALELIBDIR=\"lib\" -I../../../nxcomp -DNX_TRANS_SOCKET              -DNX_TRANS_EXIT -DXCMS -DUSE_XCB=0  -DHAS_SHM -DXF86BIGFONT   -fPIC FontInfo.c
FontInfo.c: In function 'XListFontsWithInfo':
FontInfo.c:131:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  fs->min_bounds = * (XCharStruct *) &reply.minBounds;
  ^~
FontInfo.c:132:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  fs->max_bounds = * (XCharStruct *) &reply.maxBounds;
  ^~
[...]
gcc -c -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/mike/MyDocuments/4projects/arctica-upstream/nx-libs.upstream/nx-libs.36=. -fstack-protector-strong -Wformat -Werror=format-security -g -std=c99 -Wall -Wpedantic -Wpointer-arith -Wundef    -I../.. -I../../exports/include   -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L              -D_POSIX_SOURCE -D_XOPEN_SOURCE                 -D_DEFAULT_SOURCE                                 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64                 -D_GNU_SOURCE                -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API    -DMALLOC_0_RETURNS_NULL  -DHAS_SNPRINTF -DLIBX11            -DPOSTLOCALELIBDIR=\"lib\" -I../../../nxcomp -DNX_TRANS_SOCKET              -DNX_TRANS_EXIT -DXCMS -DUSE_XCB=0     -fPIC InitExt.c
InitExt.c: In function 'XEHeadOfExtensionList':
InitExt.c:100:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return *(XExtData ***)&object;
     ^~~~~~
[...]
gcc -c -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/mike/MyDocuments/4projects/arctica-upstream/nx-libs.upstream/nx-libs.36=. -fstack-protector-strong -Wformat -Werror=format-security -g -std=c99 -Wall -Wpedantic -Wpointer-arith -Wundef    -I../.. -I../../exports/include   -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L              -D_POSIX_SOURCE -D_XOPEN_SOURCE                 -D_DEFAULT_SOURCE                                 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64                 -D_GNU_SOURCE                -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API    -DMALLOC_0_RETURNS_NULL  -DHAS_SNPRINTF -DLIBX11            -DPOSTLOCALELIBDIR=\"lib\" -I../../../nxcomp -DNX_TRANS_SOCKET              -DNX_TRANS_EXIT -DXCMS -DUSE_XCB=0     -fPIC QuKeybd.c
QuKeybd.c: In function 'XQueryKeymap':
QuKeybd.c:48:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *(struct kmap *) keys = *(struct kmap *)rep.map;  /* faster than memcpy */
                                      ^~~~
[...]
gcc -c -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/mike/MyDocuments/4projects/arctica-upstream/nx-libs.upstream/nx-libs.36=. -fstack-protector-strong -Wformat -Werror=format-security -g -std=c99 -Wall -Wpedantic -Wpointer-arith -Wundef    -I../.. -I../../exports/include   -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L              -D_POSIX_SOURCE -D_XOPEN_SOURCE                 -D_DEFAULT_SOURCE                                 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64                 -D_GNU_SOURCE                -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API    -DMALLOC_0_RETURNS_NULL  -DHAS_SNPRINTF -DLIBX11            -DPOSTLOCALELIBDIR=\"lib\" -I../../../nxcomp -DNX_TRANS_SOCKET              -DNX_TRANS_EXIT -DXCMS -DUSE_XCB=0  -DXKB   -fPIC imConv.c
imConv.c: In function '_XimGetCharCode':
imConv.c:116:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *(ucstocsConvProc**) (&cvt) = (void *)ucs_conv;
     ^
[...]
gcc -c -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/mike/MyDocuments/4projects/arctica-upstream/nx-libs.upstream/nx-libs.36=. -fstack-protector-strong -Wformat -Werror=format-security -g -std=c99 -Wall -Wpedantic -Wpointer-arith -Wundef    -I../.. -I../../exports/include   -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L              -D_POSIX_SOURCE -D_XOPEN_SOURCE                 -D_DEFAULT_SOURCE                                 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64                 -D_GNU_SOURCE                -DHAVE_SETITIMER=1 -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT -DXUSE_MTSAFE_API    -DMALLOC_0_RETURNS_NULL  -DHAS_SNPRINTF -DLIBX11            -DPOSTLOCALELIBDIR=\"lib\" -I../../../nxcomp -DNX_TRANS_SOCKET              -DNX_TRANS_EXIT -DXCMS -DUSE_XCB=0     -fPIC imCallbk.c
imCallbk.c: In function '_XimPreeditCaretCallback':
imCallbk.c:632:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16;
  ^
imCallbk.c:633:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16;
  ^
imCallbk.c:634:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  *(CARD32*)&buf[p] = (CARD32)cbs.position;
  ^
sunweaver commented 7 years ago

@uli42: @Ionic: do we have any clue how to reduce those warnings (see #407)?

uli42 commented 7 years ago

http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule

says one should use a union.

On Wed, Mar 22, 2017 at 10:52 AM, Mike Gabriel notifications@github.com wrote:

@uli42: @Ionic: do we have any clue how to reduce those warnings (see #407)?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.