[sr-dev] Strategy for visibility defines?

Greg Troxel gdt at lexort.com
Sun Dec 1 01:33:16 CET 2019


Greg Troxel <gdt at lexort.com> writes:

> This may be a NetBSD bug and I am investigating that in parallel.

The problem on NetBSD is including time.h with one set of visibility
defines, and then stdlib with another.  This seems likely to include
some other headers (e.g. sys/types.h) with restricted visbility, and
then because sys/types.h include guard is set, stdlib doesn't re-include
it and thus doesn't get the definitions with the changed visibility
macros.

While I can see the intent, it seems that code should define visibilty
macros before including any headers and then not change them, so this
doesn't feel like a NetBSD bug.  But perhaps I am wrong on that.

My minimized reproduction for this:

  #define _XOPEN_SOURCE 600

  #include <time.h>

  #undef _XOPEN_SOURCE

  #include <stdlib.h>

  int
  main(int argc, char **argv)
  {
    return 0;
  }

which fails exactly as unpatched db_ut.c.




More information about the sr-dev mailing list