[LLVMdev] [PATCH] Fix global constructor warning in sanitizer.

Samuel F Antao sfantao at us.ibm.com
Wed Sep 10 16:11:26 PDT 2014


Hi all,

If EV_VERSION > 0x010000 is not true, the compilation of
sanitizer_platform_limits_posix.cc returns the warnings:

.../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:757:12:
 warning: declaration requires a global constructor [-Wglobal-constructors]
  unsigned IOCTL_EVIOCGKEYCODE_V2 = IOCTL_NOT_PRESENT;
           ^                        ~~~~~~~~~~~~~~~~~
.../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:758:12:
 warning: declaration requires a global constructor [-Wglobal-constructors]
  unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
           ^                  ~~~~~~~~~~~~~~~~~
.../projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc:759:12:
 warning: declaration requires a global constructor [-Wglobal-constructors]
  unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
           ^                        ~~~~~~~~~~~~~~~~~

3 warnings generated.


This patch fixes the issue by adding the const attribute to
IOCTL_NOT_PRESENT.

The modified files are the following:
sanitizer_platform_limits_posix.cc
sanitizer_platform_limits_posix.h

Thanks,

Sam

(See attached file: crt_ioctl_not_present_fix.patch)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140910/0da7839d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crt_ioctl_not_present_fix.patch
Type: application/octet-stream
Size: 1192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140910/0da7839d/attachment.obj>


More information about the llvm-dev mailing list