GNU bug report logs - #75451
scratch/igc: Enable CHECK_STRUCTS

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefankangas <at> gmail.com>

Date: Thu, 9 Jan 2025 03:58:02 UTC

Severity: wishlist

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pip Cet <pipcet <at> protonmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>, Gerd Moellmann <gerd <at> gnu.org>, Andrea Corallo <acorallo <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>, 75451-done <at> debbugs.gnu.org
Subject: bug#75451: scratch/igc: Enable CHECK_STRUCTS
Date: Thu, 16 Jan 2025 14:38:31 +0000
"Stefan Kangas" <stefankangas <at> gmail.com> writes:

> Pip Cet <pipcet <at> protonmail.com> writes:
>
>> This isn't strictly about the scratch/igc branch, but I personally think
>> struct hashes should be checked in all builds, mismatches should be
>> downgraded to #warnings, and --enable-checking=all could include
>> -Werror=cpp.  (So the warnings would still abort a build with
>> --enable-checking=all, but they'd *also* show up in regular builds.)
>
> Sounds good to me.
>
>> Also, we should include them in the nativecomp ABI hash, as nativecomp
>> relies on struct layout and the tagging scheme in nontrivial ways
>> (most-positive-fixnum, for example, is treated as a compile-time
>> constant by comp.el, but I'm not sure all changes to it would
>> automatically affect the comp abi hash).
>
> I'm copying in Andrea for this part.
>
>> Changes required might include:
>>
>> * autodetection of gawk vs awk (I think this simply means using $(AWK)
>>   rather than "awk" in src/Makefile.in; this is important on some
>>   machines which provide a very different "awk")
>
> Using $(AWK) instead of raw "awk" makes sense, because why not.
>
> But which awk implementations are you concerned about more specifically?
> I would expect us to just use POSIX awk, without any gawk extensions.
> For example, I have had no issues building on Debian (using mawk by
> default) or macOS (with the BSD awk that descends from nawk, IIUC).
>
>> * igc.o and comp.o  should depend explicitly on dmpstruct.h (this is
>>   important for re-builds; in theory, the current scratch/igc branch is
>>   broken for highly parallel builds because dmpstruct.h might be
>>   generated after igc.o, but that is not important).
>
> Sounds good also.
>
>> * a hash-of-hashes for nativecomp
>>
>> Proposed partial patch:
>
> (I didn't look at the patch yet, though the above sounds like it might
> come out to more than one patch.)

You're right.  Let's start by fixing the build on Solaris 10.

Here's a WIP patch which *almost* fixes the build (with
--enable-checking=all) there.  The problem is that "ar" doesn't work,
and AC_PROG_AR, which I naively assumed would define @AR@, doesn't exist
either, on that system.  So you still have to build with "gmake AR=gar",
I guess.  (I also have to trick the makeinfo detection into letting me
build Emacs, but that's a well-known unrelated problem).

commit 738f12b467016e59086bad7c38f86b59b85f662e (HEAD)
Author: Pip Cet <pipcet <at> protonmail.com>
Date:   Thu Jan 16 13:42:03 2025 +0000

    Fix build on Solaris 10 (bug#75451)
    
    * autogen.sh: Avoid bashism.
    * configure.ac (AC_PROG_AWK): Use.
    * src/Makefile.in (AWK): Set.
    (dmpstruct.h): Use "$(AWK)", not "awk".
    * src/dired.c (DT_UNKNOWN, DT_DIR, DT_LNK): Define all three constants
    or none of them.

diff --git a/autogen.sh b/autogen.sh
index 00c20c73263..3d641b6e1f9 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -115,7 +115,7 @@ do_check=
 do_autoconf=false
 do_git=false
 
-for arg; do
+for arg in "$@"; do
     case $arg in
       --help)
 	exec echo "$0: usage: $0 [--no-check] [target...]
diff --git a/configure.ac b/configure.ac
index f78997ede24..269cbf70b60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2004,6 +2004,8 @@ AC_DEFUN
 
 dnl Some other nice autoconf tests.
 AC_PROG_INSTALL
+dnl use "gawk", not "awk", where appropriate
+AC_PROG_AWK
 dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
 dnl AC_PROG_MKDIR_P
 dnl if test "x$RANLIB" = x; then
diff --git a/src/Makefile.in b/src/Makefile.in
index 784aadd1689..d987124d29d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -60,6 +60,7 @@ LDFLAGS =
 EXEEXT = @EXEEXT@
 version = @version@
 MKDIR_P = @MKDIR_P@
+AWK = @AWK@
 # Don't use LIBS.  configure puts stuff in it that either shouldn't be
 # linked with Emacs or is duplicated by the other stuff below.
 # LIBS = @LIBS@
@@ -543,7 +544,7 @@ pdumper.o:
 endif
 dmpstruct.h: $(srcdir)/dmpstruct.awk
 dmpstruct.h: $(libsrc)/make-fingerprint$(EXEEXT) $(dmpstruct_headers)
-	$(AM_V_GEN)POSIXLY_CORRECT=1 awk -f $(srcdir)/dmpstruct.awk \
+	$(AM_V_GEN)POSIXLY_CORRECT=1 $(AWK) -f $(srcdir)/dmpstruct.awk \
 		$(dmpstruct_headers) > $@
 
 AUTO_DEPEND = @AUTO_DEPEND@
diff --git a/src/dired.c b/src/dired.c
index 89d6033f9b9..bff83ca0c95 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -79,7 +79,15 @@ dirent_namelen (struct dirent *dp)
 }
 
 #ifndef HAVE_STRUCT_DIRENT_D_TYPE
-enum { DT_UNKNOWN, DT_DIR, DT_LNK };
+enum {
+#if !defined (DT_UNKNOWN) && !defined (DT_DIR) && !defined (DT_LNK)
+  DT_UNKNOWN,
+  DT_DIR,
+  DT_LNK,
+#elif defined (DT_UNKNOWN) || defined (DT_DIR) || defined (DT_LNK)
+#error "Cannot determine DT_UNKNOWN, DT_DIR, DT_LNK"
+#endif
+};
 #endif
 
 /* Return the file type of DP.  */







This bug report was last modified 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.