Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA2zVHpkNJ_2yxfUU6B73JuGC4iygtcvjzKUobO05_GqWJ2wJg@mail.gmail.com>
Date: Tue, 9 Jul 2019 15:19:00 -0400
From: James Y Knight <jyknight@...gle.com>
To: musl@...ts.openwall.com
Subject: [PATCH] Define NULL as __null in C++ mode when using GCC or Clang.

Both GCC and Clang ship their own stddef.h which does this (musl's
stddef.h is simply ignored). But, musl also defines the macro in a
number of other headers. Thus, depending on which header you include
last, you'll end up with a different definition of NULL.

Mostly, getting musl's definition simply degrades warning diagnostics
in C++ slightly -- e.g. GCC can no longer emit this warning:
  warning: passing NULL to non-pointer argument 1 of 'int foo(long int)'
[-Wconversion-null]

If you're using Clang's modules support, it can also break
compilation. In that case, the conflicting definitions may be detected
as a module incompatibility.

A different (potentially better) fix would be to always retrieve the
definition of NULL from the compiler's stddef.h (via #define
__need_NULL #include <stddef.h>). It may also be best to delete the
musl stddef.h entirely for clarity, since it's currently ignored,
anyhow.

But, this seemed the more minimal fix.

Content of type "text/html" skipped

View attachment "0001-Define-NULL-as-__null-in-C-mode-when-using-GCC-or-Cl.patch" of type "text/x-patch" (3931 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.