Re: PATCH: remove "dead code" in make

2023-09-04 Thread Theo Buehler
On Sun, Sep 03, 2023 at 06:47:49PM +0200, Marc Espie wrote:
> On Thu, Aug 31, 2023 at 08:59:53AM +0200, Marc Espie wrote:
> > A long time ago, I tried to host our fork of make, in the hope it would get
> > picked up by other systems.
> > 
> > Accordingly, some features were added to mimic netbsd's extensions, hidden
> > behind FEATURES macros.
> > 
> > Turns out that, for better or for worse, FreeBSD decided to go with NetBSD's
> > fork of bmake, so this is just dead weight that makes stuff more complex.
> > 
> > Accordingly, config.h is no longer really needed, as it shrinks to two
> > little defines.
> > 
> > (the only part worth looking at is varmodifiers... this survived a full 
> > build
> > of base and xenocara without any issue, along with quite a few ports)
> 
> Slightly updated version. I hadn't bothered to actually remove config.h
> and thus missed an include.
> 
> Also: all remaining modifiers are now strictly either word_apply or apply,
> none does both, so I killed the extra code and added an assert just in case.
> 
> I could use some okays.  Fairly safe.

ok tb



Re: PATCH: remove "dead code" in make

2023-09-03 Thread Marc Espie
On Thu, Aug 31, 2023 at 08:59:53AM +0200, Marc Espie wrote:
> A long time ago, I tried to host our fork of make, in the hope it would get
> picked up by other systems.
> 
> Accordingly, some features were added to mimic netbsd's extensions, hidden
> behind FEATURES macros.
> 
> Turns out that, for better or for worse, FreeBSD decided to go with NetBSD's
> fork of bmake, so this is just dead weight that makes stuff more complex.
> 
> Accordingly, config.h is no longer really needed, as it shrinks to two
> little defines.
> 
> (the only part worth looking at is varmodifiers... this survived a full build
> of base and xenocara without any issue, along with quite a few ports)

Slightly updated version. I hadn't bothered to actually remove config.h
and thus missed an include.

Also: all remaining modifiers are now strictly either word_apply or apply,
none does both, so I killed the extra code and added an assert just in case.

I could use some okays.  Fairly safe.

Index: Makefile
===
RCS file: /cvs/src/usr.bin/make/Makefile,v
retrieving revision 1.64
diff -u -p -r1.64 Makefile
--- Makefile13 Jan 2020 15:41:53 -  1.64
+++ Makefile3 Sep 2023 16:44:43 -
@@ -6,8 +6,7 @@ HOSTCFLAGS+= -I${.OBJDIR} -I${.CURDIR}
 CDIAGFLAGS=-Wall -W -Wno-char-subscripts -Wstrict-prototypes -pedantic \
-Wmissing-prototypes -Wdeclaration-after-statement -std=c99
 
-CDEFS+=-DHAS_PATHS_H
-CDEFS+=-DHAS_EXTENDED_GETCWD
+CDEFS+=-DMAKE_BSIZE=256 -DDEFMAXJOBS=4
 #CDEFS+=-DHAS_STATS
 
 DPADD += ${LIBUTIL}
Index: arch.c
===
RCS file: /cvs/src/usr.bin/make/arch.c,v
retrieving revision 1.93
diff -u -p -r1.93 arch.c
--- arch.c  17 Feb 2023 17:59:36 -  1.93
+++ arch.c  3 Sep 2023 16:44:43 -
@@ -82,7 +82,6 @@
 #include 
 #include 
 #include 
-#include "config.h"
 #include "defines.h"
 #include "buf.h"
 #include "dir.h"
Index: buf.c
===
RCS file: /cvs/src/usr.bin/make/buf.c,v
retrieving revision 1.29
diff -u -p -r1.29 buf.c
--- buf.c   13 Jan 2020 13:54:44 -  1.29
+++ buf.c   3 Sep 2023 16:44:43 -
@@ -75,7 +75,6 @@
 #include 
 #include 
 #include 
-#include "config.h"
 #include "defines.h"
 #include "buf.h"
 #include "stats.h"
Index: cmd_exec.c
===
RCS file: /cvs/src/usr.bin/make/cmd_exec.c,v
retrieving revision 1.12
diff -u -p -r1.12 cmd_exec.c
--- cmd_exec.c  31 Aug 2023 06:53:28 -  1.12
+++ cmd_exec.c  3 Sep 2023 16:44:43 -
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include "config.h"
 #include "defines.h"
 #include "cmd_exec.h"
 #include "buf.h"
Index: compat.c
===
RCS file: /cvs/src/usr.bin/make/compat.c,v
retrieving revision 1.93
diff -u -p -r1.93 compat.c
--- compat.c26 Jan 2020 12:41:21 -  1.93
+++ compat.c3 Sep 2023 16:44:43 -
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include "config.h"
 #include "defines.h"
 #include "dir.h"
 #include "engine.h"
Index: cond.c
===
RCS file: /cvs/src/usr.bin/make/cond.c,v
retrieving revision 1.54
diff -u -p -r1.54 cond.c
--- cond.c  21 Dec 2019 15:29:25 -  1.54
+++ cond.c  3 Sep 2023 16:44:44 -
@@ -42,7 +42,6 @@
 #include 
 #include 
 #include 
-#include "config.h"
 #include "defines.h"
 #include "dir.h"
 #include "buf.h"
Index: config.h
===
RCS file: config.h
diff -N config.h
--- config.h5 Jan 2022 02:00:55 -   1.21
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,120 +0,0 @@
-#ifndef CONFIG_H
-#define CONFIG_H
-
-/* $OpenBSD: config.h,v 1.21 2022/01/05 02:00:55 jsg Exp $ */
-/* $NetBSD: config.h,v 1.7 1996/11/06 17:59:03 christos Exp $  */
-
-/*
- * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
- * Copyright (c) 1988, 1989 by Adam de Boor
- * Copyright (c) 1989 by Berkeley Softworks
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Adam de Boor.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without