Closed Bug 1369864 Opened 2 years ago Closed 2 years ago

pkix gtests trigger "gtest-port.h:1288:37: error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant]" and more

Categories

(Core :: Security: PSM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Filing this bug for a build warning that I'm getting (many times over) for an issue in a gtest header that we use in security/pkix/test/gtest/ (which is a directory that treats build warnings as errors, if you use --enable-warnings-as-errors).

The warnings start out like this:
============
 0:04.49 In file included from /scratch/work/builds/mozilla-inbound/mozilla/security/pkix/test/gtest/pkixcert_signature_algorithm_tests.cpp:7:
 0:04.49 In file included from /scratch/work/builds/mozilla-inbound/mozilla/security/pkix/test/gtest/pkixgtest.h:49:
 0:04.49 In file included from /scratch/work/builds/mozilla-inbound/obj/dist/include/gtest/gtest.h:58:
 0:04.49 In file included from /scratch/work/builds/mozilla-inbound/obj/dist/include/gtest/internal/gtest-internal.h:40:
 0:04.49 /scratch/work/builds/mozilla-inbound/obj/dist/include/gtest/internal/gtest-port.h:1288:37: error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant]
 0:04.49 inline void FlushInfoLog() { fflush(NULL); }
 0:04.49                                     ^~~~
 0:04.49                                     nullptr
 0:04.49 /opt/llvm-304217/lib/clang/5.0.0/include/stddef.h:100:18: note: expanded from macro 'NULL'
 0:04.49 #    define NULL __null
 0:04.49                  ^
 0:04.49 In file included from /scratch/work/builds/mozilla-inbound/mozilla/security/pkix/test/gtest/pkixcert_signature_algorithm_tests.cpp:7:
 0:04.49 In file included from /scratch/work/builds/mozilla-inbound/mozilla/security/pkix/test/gtest/pkixgtest.h:49:
 0:04.50 In file included from /scratch/work/builds/mozilla-inbound/obj/dist/include/gtest/gtest.h:58:
 0:04.50 In file included from /scratch/work/builds/mozilla-inbound/obj/dist/include/gtest/internal/gtest-internal.h:40:
 0:04.50 /scratch/work/builds/mozilla-inbound/obj/dist/include/gtest/internal/gtest-port.h:1465:20: error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant]
 0:04.50   nanosleep(&time, NULL);
 0:04.50                    ^~~~
 0:04.50                    nullptr
============

...and these warnings/errors go on for pages.


Basically, gtest uses C-style "NULL" to represent the null pointer, and NULL is #defined to 0 (or rather to __null which I'm guessing is equivalent to 0), and clang complains about that with its new -Wzero-as-null-pointer-constant build warning, which we enable by default [as part of a blanket warning-enabling] in the bleeding-edge clang versions that have this warning.

Anyway -- let's just suppress this build warning in security/pkix/test/gtest/ fort the time being, since these gtest headers are 3rd-party code and we don't really want to have to spot fix them.
Assignee: nobody → dholbert
Blocks: buildwarning
Component: Security → Security: PSM
See Also: → 1369806
Comment on attachment 8873972 [details]
Bug 1369864: Suppress clang -Wno-zero-as-null-pointer-constant build warning, in pkix/test/gtest.

https://reviewboard.mozilla.org/r/145412/#review149380

Ugh. c'mon, gtest.
r=me
Attachment #8873972 - Flags: review?(dkeeler) → review+
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/95432b49cac4
Suppress clang -Wno-zero-as-null-pointer-constant build warning, in pkix/test/gtest. r=keeler
https://hg.mozilla.org/mozilla-central/rev/95432b49cac4
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.