public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109021] New: accept size parameter in extern C
@ 2023-03-04 12:02 muecker at gwdg dot de
  2023-03-04 15:18 ` [Bug c++/109021] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: muecker at gwdg dot de @ 2023-03-04 12:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

            Bug ID: 109021
           Summary: accept size parameter in extern C
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

A problem I encounter sometimes when using newer C headers in C++ is
with functions that have array argument with a size parameter:

extern "C" void foo(int N, char buf[N]);

I think g++ should accept this in general or only for extern "C".

At least for 1D arrays this should be easy as it could simply ignore the size 
and only emit a diagnostic with -pedantic.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/109021] accept size parameter in extern C
  2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
@ 2023-03-04 15:18 ` pinskia at gcc dot gnu.org
  2023-03-04 15:31 ` muecker at gwdg dot de
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-04 15:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
extern "C" just changes the language linkage but does not change the language
which the declaration is written in.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/109021] accept size parameter in extern C
  2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
  2023-03-04 15:18 ` [Bug c++/109021] " pinskia at gcc dot gnu.org
@ 2023-03-04 15:31 ` muecker at gwdg dot de
  2023-08-06 13:58 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: muecker at gwdg dot de @ 2023-03-04 15:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

--- Comment #2 from Martin Uecker <muecker at gwdg dot de> ---
True. But we could still take it as a hint about where this is not useful to
users to diagnose this as an error.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/109021] accept size parameter in extern C
  2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
  2023-03-04 15:18 ` [Bug c++/109021] " pinskia at gcc dot gnu.org
  2023-03-04 15:31 ` muecker at gwdg dot de
@ 2023-08-06 13:58 ` schwab@linux-m68k.org
  2023-08-15 13:19 ` muecker at gwdg dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2023-08-06 13:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
*** Bug 110920 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/109021] accept size parameter in extern C
  2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
                   ` (2 preceding siblings ...)
  2023-08-06 13:58 ` schwab@linux-m68k.org
@ 2023-08-15 13:19 ` muecker at gwdg dot de
  2023-08-15 23:53 ` pinskia at gcc dot gnu.org
  2023-08-17  6:56 ` muecker at gwdg dot de
  5 siblings, 0 replies; 7+ messages in thread
From: muecker at gwdg dot de @ 2023-08-15 13:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

--- Comment #4 from Martin Uecker <muecker at gwdg dot de> ---

Sorry, how can an enhancement request that addresses a real C/C++ compatibility
problem be marked "resolved invalid" ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/109021] accept size parameter in extern C
  2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
                   ` (3 preceding siblings ...)
  2023-08-15 13:19 ` muecker at gwdg dot de
@ 2023-08-15 23:53 ` pinskia at gcc dot gnu.org
  2023-08-17  6:56 ` muecker at gwdg dot de
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-15 23:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Uecker from comment #4)
> Sorry, how can an enhancement request that addresses a real C/C++
> compatibility problem be marked "resolved invalid" ?

Because GCC does like these days to add huge extensions to the C++ language.
Maybe you could bring this up to WG21 (C++ standards committee) as a paper
which fully thought out (and an implementation either GCC or clang as an open
source example). GCC might take that implementation and have it as an extension
...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/109021] accept size parameter in extern C
  2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
                   ` (4 preceding siblings ...)
  2023-08-15 23:53 ` pinskia at gcc dot gnu.org
@ 2023-08-17  6:56 ` muecker at gwdg dot de
  5 siblings, 0 replies; 7+ messages in thread
From: muecker at gwdg dot de @ 2023-08-17  6:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109021

--- Comment #6 from Martin Uecker <muecker at gwdg dot de> ---

Note that I do not propose to add variably modified types to C++.  This would
indeed be a major extension.  I simply propose to ignore the size expressions
in C headers as a usability improvement.  My patch I have somewhere for this
are a couple lines of code.

I plan to bring this up to WG21 anyway, but standards should ideally
standardize things where there exists prior experience.  It would be helpful if
GCC takes part in this process.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-17  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-04 12:02 [Bug c++/109021] New: accept size parameter in extern C muecker at gwdg dot de
2023-03-04 15:18 ` [Bug c++/109021] " pinskia at gcc dot gnu.org
2023-03-04 15:31 ` muecker at gwdg dot de
2023-08-06 13:58 ` schwab@linux-m68k.org
2023-08-15 13:19 ` muecker at gwdg dot de
2023-08-15 23:53 ` pinskia at gcc dot gnu.org
2023-08-17  6:56 ` muecker at gwdg dot de

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).