From: Christian Weisgerber Subject: cpp moves to /usr/bin: base (1/3) To: tech@openbsd.org Date: Fri, 26 Jun 2026 19:20:53 +0200 TL;DR: The cpp.sh wrapper no longer serves any purpose. Let's retire it and install the cpp executable directly in /usr/bin. I've gone through the history of usr.bin/cpp/cpp.sh. It was introduced in 4.4BSD as "Transitional front end to CCCP to make it behave like (Reiser) CCP". That's one for the historians. In OpenBSD, cpp.sh has had multiple purposes: * Run cpp -traditional by default. - We no longer do this. * Ensure that cpp always defines __GNUC__ like cc. - Already removed, because gcc4 and clang do this by default. * Figure out the location of the cpp executable. - A no-op, because the gcc4 and clang cpp are both installed as /usr/libexec/cpp. * Remove nonstandard include paths. - This started out in 4.4BSD. My best guess is that it dropped /usr/local/include from the default search path. Our compilers are already configured to only search the standard include path. I think at this point any subtle differences between calling the wrapper or the cpp executable directly are accidental. The diff below removes the cpp.sh wrapper and moves the actual cpp executable from /usr/libexec to /usr/bin. I don't have any gcc4 architecture, so that part is untested. Can somebody try it there? Diffs for xenocara and ports to follow. ----------------------------------------------- commit bf791437fe4855a4f3cc878414f73ac52a8da160 (cpp) from: Christian Weisgerber date: Tue Jun 23 13:38:49 2026 UTC retire the cpp.sh script and install the cpp binary directly in /usr/bin The cpp.sh wrapper script no longer serves any purpose: * We no longer force the preprocessor into -traditional mode. * Our compilers already define __GNUC__ for the preprocessor. * The location of cpp is well known. * Our compilers only use the standard include paths by default. diff be56f357d439943f42ea57af7e1c5a8d0cf1c5fa bf791437fe4855a4f3cc878414f73ac52a8da160 commit - be56f357d439943f42ea57af7e1c5a8d0cf1c5fa commit + bf791437fe4855a4f3cc878414f73ac52a8da160 blob - 7acadbdb4a0d179d20eca58e869348dd9806030b blob + 569913fad11d52bc43b88ad621b10edb0973e123 --- distrib/sets/lists/base/mi +++ distrib/sets/lists/base/mi @@ -468,6 +468,7 @@ ./usr/bin/compress ./usr/bin/corelist ./usr/bin/cpan +./usr/bin/cpp ./usr/bin/crontab ./usr/bin/csplit ./usr/bin/ctags @@ -2734,7 +2735,6 @@ ./usr/libexec/auth/login_token ./usr/libexec/auth/login_yubikey ./usr/libexec/comsat -./usr/libexec/cpp ./usr/libexec/cvs ./usr/libexec/cvs/contrib ./usr/libexec/cvs/contrib/clmerge blob - 914cac2270cb1046c2995d24506d237c75d27bd8 blob + 5da95aafdffb64cfe635518cb6644e57a5167b96 --- distrib/sets/lists/comp/mi +++ distrib/sets/lists/comp/mi @@ -1,7 +1,6 @@ ./sys ./usr/bin/addr2line ./usr/bin/c++filt -./usr/bin/cpp ./usr/bin/ctfdump ./usr/bin/flex ./usr/bin/flex++ blob - ff41b03cdbb59b9a34425703d831b269e63dba6b blob + 2f6e3f18a5b4ab9503e311535ac85e3c979d8b53 --- gnu/usr.bin/cc/cpp/Makefile +++ gnu/usr.bin/cc/cpp/Makefile @@ -6,8 +6,6 @@ .include "${.CURDIR}/../Makefile.inc" .include "${.CURDIR}/../Makefile.fe" -BINDIR= /usr/libexec - PROG= cpp SRCS+= cppspec.c blob - 78a7b5534f9e3e17d6e5f975c3d0c39709f67c03 blob + 63379d04315340a32223be9c3dc499a94aad557a --- gnu/usr.bin/clang/clang/Makefile +++ gnu/usr.bin/clang/clang/Makefile @@ -18,7 +18,7 @@ LINKS= ${BINDIR}/clang ${BINDIR}/clang++ \ .if ${COMPILER_VERSION:L} == "clang" LINKS+= ${BINDIR}/clang ${BINDIR}/cc \ ${BINDIR}/clang ${BINDIR}/c++ \ - ${BINDIR}/clang ${LIBEXECDIR}/cpp + ${BINDIR}/clang ${BINDIR}/cpp maninstall: .if !defined(NOMAN) blob - 4810b0af717de88060e24a9589eb9825603cf814 blob + 03be3c1d5fdc26ee79db17efcd82320f8aa70453 --- usr.bin/Makefile +++ usr.bin/Makefile @@ -5,7 +5,7 @@ SUBDIR= apply arch at aucat audioctl awk banner \ basename bc bgplg \ biff cal calendar cap_mkdb cdio chpass cmp col colrm \ - column comm compress cpp crontab csplit ctags ctfconv ctfdump \ + column comm compress crontab csplit ctags ctfconv ctfdump \ cu cut cvs \ dc deroff diff diff3 dig dirname doas du encrypt env expand false file \ find fgen finger fmt fold from fstat ftp gencat getcap \ blob - 5cd0d7095fa5b43119ede5d8f6c7c22c7f7dbc3f blob + 5f3d2ea68684fda0813f887c39892c9441322f89 --- usr.bin/calendar/pathnames.h +++ usr.bin/calendar/pathnames.h @@ -33,7 +33,7 @@ #include -#define _PATH_CPP "/usr/libexec/cpp" +#define _PATH_CPP "/usr/bin/cpp" /* XXX -- fix when cpp parses arguments rationally */ #define _PATH_INCLUDE "-I/usr/share/calendar" blob - 5dad72697ec57f52abbd339ba5a66f7759511da0 (mode 644) blob + /dev/null --- usr.bin/cpp/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $OpenBSD: Makefile,v 1.13 2025/10/23 19:06:10 miod Exp $ - -NOMAN= - -PROG=cpp -SRCS= -INSTALL_STRIP= - -cpp: cpp.sh - sed -e 's/@GNUC@//' ${.CURDIR}/cpp.sh >$@ - -.include blob - ef56f5f64c94a813c0a22d06061a76062d83d8d7 (mode 644) blob + /dev/null --- usr.bin/cpp/cpp.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/ksh -# $OpenBSD: cpp.sh,v 1.11 2026/06/22 22:09:13 naddy Exp $ - -# -# Copyright (c) 1990 The Regents of the University of California. -# All rights reserved. -# -# This code is derived from software contributed to Berkeley by -# the Systems Programming Group of the University of Utah Computer -# Science Department. -# -# 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 specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)usr.bin.cpp.sh 6.5 (Berkeley) 4/1/91 -# -# Transitional front end to CCCP to make it behave like (Reiser) CCP: -# specifies -traditional -# doesn't search gcc-include -# -PATH=/usr/bin:/bin:/usr/sbin:/sbin -TRAD= -DGNUC="@GNUC@" -STDINC="-I/usr/include" -set -A OPTS -set -A INCS -- "-nostdinc" -FOUNDFILES=false - -CPP=/usr/libexec/cpp -if [ ! -x $CPP ]; then - CPP=`cc -print-search-dirs | sed -ne '/^install: /s/install: \(.*\)/\1cpp/p'`; - if [ ! -x $CPP ]; then - echo "$0: installation problem: $CPP not found/executable" >&2 - exit 1 - fi -fi - -while [ $# -gt 0 ] -do - A="$1" - shift - - case $A in - -nostdinc) - STDINC= - ;; - -traditional) - TRAD=-traditional - ;; - -notraditional) - TRAD= - ;; - # options that take an argument and that should be sorted before - # the $STDINC option - -I | -imacros | -include | -idirafter | -iprefix | -iwithprefix | \ - -iwithprefixbefore | -isysroot | -imultilib | -isystem | -iquote) - INCS[${#INCS[@]}]=$A - INCS[${#INCS[@]}]=$1 - shift - ;; - -I*) - INCS[${#INCS[@]}]=$A - ;; - # other options that take an argument - -MF | -MT | -MQ | -x | -D | -U | -o | -A) - OPTS[${#OPTS[@]}]=$A - OPTS[${#OPTS[@]}]=$1 - shift - ;; - -U__GNUC__) - DGNUC= - OPTS[${#OPTS[@]}]=$A - ;; - -*) - OPTS[${#OPTS[@]}]=$A - ;; - *) - FOUNDFILES=true - $CPP $TRAD $DGNUC "${INCS[@]}" $STDINC "${OPTS[@]}" "$A" || - exit - ;; - esac -done - -if ! $FOUNDFILES -then - # read standard input - exec $CPP $TRAD $DGNUC "${INCS[@]}" $STDINC "${OPTS[@]}" -fi - -exit 0 -- Christian "naddy" Weisgerber naddy@mips.inka.de