public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29399] Wrong definition of setjmp
Date: Fri, 29 Jul 2022 12:25:55 +0000	[thread overview]
Message-ID: <bug-29399-131-qS7W25W2ib@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29399-131@http.sourceware.org/bugzilla/>

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

--- Comment #8 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Zack Weinberg from comment #6)
> I don't think the standard is ambiguous at all.  Its wording could be
> improved, but there's only one interpretation that makes sense.
> 
> Since at least C11, section 7.1.3p2 reads in part
> 
> > If the program declares or defines an identifier in a context in which it is reserved (other than as allowed by 7.1.4), **or defines a reserved identifier as a macro name**, the behavior is undefined.
> 
> The clause set off by double asterisks doesn't make any sense unless "a
> reserved identifier" is understood broadly: if the program defines an
> identifier that is reserved *in any context* as macro name, the behavior is
> undefined.

On the other hand, 6.2.1p1 refuses to define scope for macro names and macro
parameters, so it's hard to see how the an “identifier with file scope” could
refer to a macro name.

I think 7.1.3 leaves something to be desired anyway because it makes it pretty
clear that this is valid:

#define tm_sec puts ("Hello, world!")
#include <time.h>

int
main (void)
{
  tm_sec;
  return 0;
}

But to implement that, we would have to use non-standard preprocessor features
(#pragma push_macro, #pragma pop_macro).

(Historically, structure fields had file scope (similar to some ML flavors),
but that hasn't been true for a long, long time.)

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

  parent reply	other threads:[~2022-07-29 12:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 19:25 [Bug libc/29399] New: " pavel.morozkin at gmail dot com
2022-07-24 21:28 ` [Bug libc/29399] " sam at gentoo dot org
2022-07-24 21:34 ` ldv at sourceware dot org
2022-07-24 22:06 ` pavel.morozkin at gmail dot com
2022-07-24 22:09 ` schwab@linux-m68k.org
2022-07-28 16:33 ` pavel.morozkin at gmail dot com
2022-07-28 16:50 ` fweimer at redhat dot com
2022-07-28 19:38 ` zackw at panix dot com
2022-07-29  6:53 ` pavel.morozkin at gmail dot com
2022-07-29 12:25 ` fweimer at redhat dot com [this message]
2022-07-29 14:03 ` pavel.morozkin at gmail dot com
2022-07-29 15:53 ` schwab@linux-m68k.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-29399-131-qS7W25W2ib@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).