public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nathan at acm dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug build/27596] New: bits/libc-header-start.h is C++ header-unit unfriendly
Date: Wed, 17 Mar 2021 13:35:17 +0000	[thread overview]
Message-ID: <bug-27596-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=27596

            Bug ID: 27596
           Summary: bits/libc-header-start.h is C++ header-unit unfriendly
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: nathan at acm dot org
                CC: carlos at redhat dot com
  Target Milestone: ---

bits/libc-header-start.h is, IIUC, morally glibc's config.h.  It has protection
in it so that it is only included from within glibc:

#ifndef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
# error "Never include <bits/libc-header-start.h> directly."
#endif

#undef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION

This makes it unfriendly to being compiled as a stand-alone C++ header unit,
unless you add -D__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION on the command
line.  But that does raise some questions:
a) does it ever do more than define/undefine macros?
b) does it ever produce differing sets of macro definitions *within a single
(consistent) build*.

#b breaks a header-unit requirement, which would be unfortunate.

We can work around this issue by textually including it, so it is not a
header-unit.  But that leads to:

1) inefficencies in building, as now each includer, built as a header unit,
will end up providing the macros and the ultimate importer will check all those
macro definitions are the same, lazily at the point of expansion.

2) If #b above is true, those sets of definitions/undefinitions could conflict,
leading to compilation errors at the point of expansion.  We have not observed
this, but we've only done minimal testing right now.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2021-03-17 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 13:35 nathan at acm dot org [this message]
2021-03-17 20:36 ` [Bug build/27596] " joseph at codesourcery dot com
2021-03-18 11:35 ` nathan at acm dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27596-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).