public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/111530] New: Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency
@ 2023-09-21 23:50 macro at orcam dot me.uk
2023-09-25 12:45 ` [Bug modula2/111530] " gaius at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: macro at orcam dot me.uk @ 2023-09-21 23:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111530
Bug ID: 111530
Summary: Unable to build GM2 standard library on BSD due to a
`getopt_long_only' GNU extension dependency
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: modula2
Assignee: gaius at gcc dot gnu.org
Reporter: macro at orcam dot me.uk
Target Milestone: ---
Target: *-*-netbsd*
As in the summary the GM2 frontend fails to build for a BSD system, here
the `vax-dec-netbsdelf' target specifically, due to an unguarded
requirement for the presence of a GNU extension, `getopt_long_only'
specifically, in the system C library. This is not a standard ISO C or
POSIX function and is not therefore provided by NetBSD (version 9.0
here):
.../gcc/libgm2/libm2pim/cgetopt.cc: In function 'int
m2pim_cgetopt_getopt_long_only(int, char**, char*, const option*, int*)':
.../gcc/libgm2/libm2pim/cgetopt.cc:74:11: error: 'getopt_long_only' was not
declared in this scope; did you mean 'getopt_long'?
74 | int r = getopt_long_only (argc, argv, optstring, longopts,
longindex);
| ^~~~~~~~~~~~~~~~
| getopt_long
make[5]: *** [Makefile:888: cgetopt.lo] Error 1
It is not clear to me from GM2 documentation if `getopt_long_only' is
provided as a part of the standard Modula 2 language API (in which case
it should be substituted, possibly from our in-tree libiberty) or just
as a convenience pass-through to the system facility (in which case it
should be disabled). Either way it has to be autoconf'd for and handled
accordingly.
NB NetBSD does implement `getopt_long' as an own extension (as indicated
by the error message above) using an almost identical prototype, however
documentation indicates the semantics is slightly different from GNU
`getopt_long' for corner cases. I'm unsure if that matters for GM2, but
thought it would be worth mentioning since I noticed that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug modula2/111530] Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency
2023-09-21 23:50 [Bug modula2/111530] New: Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency macro at orcam dot me.uk
@ 2023-09-25 12:45 ` gaius at gcc dot gnu.org
2023-10-26 19:42 ` gaius at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-09-25 12:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111530
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
Last reconfirmed| |2023-09-25
--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Many thanks for the bug report and hints on how to fix it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug modula2/111530] Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency
2023-09-21 23:50 [Bug modula2/111530] New: Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency macro at orcam dot me.uk
2023-09-25 12:45 ` [Bug modula2/111530] " gaius at gcc dot gnu.org
@ 2023-10-26 19:42 ` gaius at gcc dot gnu.org
2023-10-27 14:55 ` cvs-commit at gcc dot gnu.org
2023-10-27 14:58 ` gaius at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-10-26 19:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111530
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gaius at gcc dot gnu.org
--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 56316
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56316&action=edit
Proposed fix
Here is a proposed patch which is currently undergoing bootstrap testing. I
thought I'd post the proposed patch for testing and potential comments.
It uses the libiberty getopt long functions (wrapped up inside
libgm2/libm2pim/cgetopt.cc) and only enables this implementation if configure
detects no getopt_long and friends on the target.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug modula2/111530] Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency
2023-09-21 23:50 [Bug modula2/111530] New: Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency macro at orcam dot me.uk
2023-09-25 12:45 ` [Bug modula2/111530] " gaius at gcc dot gnu.org
2023-10-26 19:42 ` gaius at gcc dot gnu.org
@ 2023-10-27 14:55 ` cvs-commit at gcc dot gnu.org
2023-10-27 14:58 ` gaius at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-27 14:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111530
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:
https://gcc.gnu.org/g:e5f6a5ad7ceece5238fc3d63f7ea92574df4264d
commit r14-4976-ge5f6a5ad7ceece5238fc3d63f7ea92574df4264d
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Fri Oct 27 15:54:48 2023 +0100
PR modula2/111530: Build failure on BSD due to getopt_long_only GNU
extension dependency
This patch uses the libiberty getopt long functions (wrapped up inside
libgm2/libm2pim/cgetopt.cc) and only enables this implementation if
libgm2/configure.ac detects no getopt_long and friends on the target.
gcc/m2/ChangeLog:
PR modula2/111530
* gm2-libs-ch/cgetopt.c (cgetopt_cgetopt_long): Re-format.
(cgetopt_cgetopt_long_only): Re-format.
(cgetopt_SetOption): Re-format and assign flag to NULL
if name is also NULL.
* gm2-libs/GetOpt.def (AddLongOption): Add index parameter
and change flag to be a VAR parameter rather than a pointer.
(GetOptLong): Re-format.
(GetOpt): Correct comment.
* gm2-libs/GetOpt.mod: Re-write to rely on cgetopt rather
than implement long option creation in GetOpt.
* gm2-libs/cgetopt.def (SetOption): has_arg type is INTEGER.
libgm2/ChangeLog:
PR modula2/111530
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac (AC_CHECK_HEADERS): Include getopt.h.
(GM2_CHECK_LIB): getopt_long check.
(GM2_CHECK_LIB): getopt_long_only check.
* libm2cor/Makefile.in: Regenerate.
* libm2iso/Makefile.in: Regenerate.
* libm2log/Makefile.in: Regenerate.
* libm2min/Makefile.in: Regenerate.
* libm2pim/Makefile.in: Regenerate.
* libm2pim/cgetopt.cc: Re-write using conditional on configure
and long function code from libiberty/getopt.c.
gcc/testsuite/ChangeLog:
PR modula2/111530
* gm2/pimlib/run/pass/testgetopt.mod: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug modula2/111530] Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency
2023-09-21 23:50 [Bug modula2/111530] New: Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency macro at orcam dot me.uk
` (2 preceding siblings ...)
2023-10-27 14:55 ` cvs-commit at gcc dot gnu.org
@ 2023-10-27 14:58 ` gaius at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-10-27 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111530
Gaius Mulley <gaius at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now that the patch has been applied and bootstrap succeeded on netbsd
9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-27 14:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 23:50 [Bug modula2/111530] New: Unable to build GM2 standard library on BSD due to a `getopt_long_only' GNU extension dependency macro at orcam dot me.uk
2023-09-25 12:45 ` [Bug modula2/111530] " gaius at gcc dot gnu.org
2023-10-26 19:42 ` gaius at gcc dot gnu.org
2023-10-27 14:55 ` cvs-commit at gcc dot gnu.org
2023-10-27 14:58 ` gaius at gcc dot gnu.org
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).