[llvm-bugs] [Bug 36520] New: New diagnostic -Wzero-as-null-pointer-constant warns on code in system headers.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 26 09:34:38 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36520

            Bug ID: 36520
           Summary: New diagnostic -Wzero-as-null-pointer-constant warns
                    on code in system headers.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lukasza at chromium.org
                CC: llvm-bugs at lists.llvm.org

This is a follow-up for https://bugs.llvm.org/show_bug.cgi?id=33771 - even
after this bug got fixed, some system headers result in warnings/errors:

    In file included from ../../base/message_loop/message_pump_glib.cc:10:
    In file included from
../../build/linux/debian_stretch_amd64-sysroot/usr/include/glib-2.0/glib.h:50:
    In file included from
../../build/linux/debian_stretch_amd64-sysroot/usr/include/glib-2.0/glib/ghash.h:33:
    In file included from
../../build/linux/debian_stretch_amd64-sysroot/usr/include/glib-2.0/glib/glist.h:32:
   
../../build/linux/debian_stretch_amd64-sysroot/usr/include/glib-2.0/glib/gmem.h:192:10:
error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant]
      *ptr = NULL;
             ^~~~
             nullptr
   
../../third_party/llvm-build/Release+Asserts/lib/clang/7.0.0/include/stddef.h:100:18:
note: expanded from macro 'NULL'
    #    define NULL __null

base/message_loop/message_pump_glib.cc looks like this (in particular, note
that |#include <foo.h>| rather than |#include "foo.h"| was used):

    ...    
    #include "base/message_loop/message_pump_glib.h"

    #include <fcntl.h>
    #include <math.h>

    #include <glib.h>  // <--- THIS PULLS IN SYSTEM HEADERS THAT RESULT IN THE
WARNING

    #include "base/lazy_instance.h"
    #include "base/logging.h"
    ...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180226/9c29b7ac/attachment.html>


More information about the llvm-bugs mailing list