Skip to content

Commit

Permalink
Mass rename C++ sources to .cc/.hh extension
Browse files Browse the repository at this point in the history
As planned from the start of the C++ journey, rename all C++ files to
a C++ extension to remove the confusion for both humans and tooling -
so we now get to remove the associated cmake hacks to force it to
use a C++ compiler.

We initially decided on going for .cxx/.hxx extension on the grounds
that it's the technically most right thing to do as it matches with
the build toolchain CXX/CXXFLAGS and all that. But at around 1/4 way
through the rename I concluded that this is not only eye-bleeding ugly,
it also totally obfuscates the difference between headers and sources
in the visual noise it creates. Last but not least, it makes you think
of All My Ex's Live in Texas, and that's about the last thing in I
want to be thinking off. Both the song, and the exes.

Those of us working on rpm for a living need to think of their
well-being, both mental and physical. The choice of .cc/.hh extension
is primarily based on that: the .cxx/.hxx extension proved to be almost
revolting in practise. To my total surprise really, I never expected
this to matter at all. Maybe others have had similar feelings though,
.cc/.hh is one of the more common choices, for example gcc and binutils
use that.

Fixes: rpm-software-management#3316
  • Loading branch information
pmatilai committed Oct 3, 2024
1 parent 17e15ba commit 6a7284f
Show file tree
Hide file tree
Showing 158 changed files with 305 additions and 354 deletions.
23 changes: 7 additions & 16 deletions build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ set_target_properties(librpmbuild PROPERTIES
SOVERSION ${RPM_SOVERSION}
)
target_sources(librpmbuild PRIVATE
build.c files.c misc.c pack.c
parseSimpleScript.c parseChangelog.c parseDescription.c
parseFiles.c parsePreamble.c parsePrep.c parseReqs.c parseScript.c
parseSpec.c parseList.c reqprov.c rpmfc.c spec.c
parsePolicies.c policies.c
rpmbuild_internal.h rpmbuild_misc.h
speclua.c
build.cc files.cc misc.cc pack.cc
parseSimpleScript.cc parseChangelog.cc parseDescription.cc
parseFiles.cc parsePreamble.cc parsePrep.cc parseReqs.cc parseScript.cc
parseSpec.cc parseList.cc reqprov.cc rpmfc.cc spec.cc
parsePolicies.cc policies.cc
rpmbuild_internal.hh rpmbuild_misc.hh
speclua.cc
)

target_include_directories(librpmbuild
Expand Down Expand Up @@ -53,15 +53,6 @@ if(OpenMP_C_FOUND)
target_link_libraries(librpmbuild PRIVATE OpenMP::OpenMP_C)
endif()

set (cxx_sources
build.c files.c misc.c pack.c
parseChangelog.c parseDescription.c parseFiles.c parseList.c
parsePolicies.c parsePreamble.c parsePrep.c parseReqs.c
parseScript.c parseSimpleScript.c parseSpec.c
policies.c reqprov.c rpmfc.c
spec.c speclua.c
)
set_source_files_properties(${cxx_sources} PROPERTIES LANGUAGE CXX)
if (OpenMP_C_FOUND)
target_link_libraries(librpmbuild PRIVATE OpenMP::OpenMP_CXX)
endif()
Expand Down
4 changes: 2 additions & 2 deletions build/build.c → build/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include <rpm/rpmlog.h>
#include <rpm/rpmfileutil.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"

#include "debug.h"

Expand Down
8 changes: 4 additions & 4 deletions build/files.c → build/files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
#include <rpm/rpmlog.h>
#include <rpm/rpmbase64.h>

#include "rpmio_internal.h" /* XXX rpmioSlurp */
#include "rpmio_internal.hh" /* XXX rpmioSlurp */
#include "rpmfts.h"
#include "rpmfi_internal.h" /* XXX fi->apath */
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmfi_internal.hh" /* XXX fi->apath */
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"

#include "debug.h"
#include <libgen.h>
Expand Down
2 changes: 1 addition & 1 deletion build/misc.c → build/misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <rpm/rpmstring.h>
#include "rpmbuild_misc.h"
#include "rpmbuild_misc.hh"
#include "debug.h"

#define BUF_CHUNK 1024
Expand Down
11 changes: 5 additions & 6 deletions build/pack.c → build/pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
#include <rpm/rpmfileutil.h>
#include <rpm/rpmlog.h>

#include "rpmio_internal.h" /* fdInitDigest, fdFiniDigest */
#include "fsm.h"
#include "signature.h"
#include "rpmlead.h"
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmio_internal.hh" /* fdInitDigest, fdFiniDigest */
#include "signature.hh"
#include "rpmlead.hh"
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"

#include "debug.h"

Expand Down
2 changes: 1 addition & 1 deletion build/parseChangelog.c → build/parseChangelog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <rpm/header.h>
#include <rpm/rpmlog.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"

#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; }
Expand Down
2 changes: 1 addition & 1 deletion build/parseDescription.c → build/parseDescription.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <rpm/header.h>
#include <rpm/rpmlog.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"

int parseDescription(rpmSpec spec)
Expand Down
2 changes: 1 addition & 1 deletion build/parseFiles.c → build/parseFiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <rpm/rpmlog.h>
#include <rpm/rpmfileutil.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"

int parseFiles(rpmSpec spec)
Expand Down
2 changes: 1 addition & 1 deletion build/parseList.c → build/parseList.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "system.h"

#include <rpm/rpmlog.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"


Expand Down
2 changes: 1 addition & 1 deletion build/parsePolicies.c → build/parsePolicies.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <rpm/rpmbuild.h>
#include <rpm/rpmlog.h>
#include <rpm/rpmfileutil.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"

int parsePolicies(rpmSpec spec)
Expand Down
4 changes: 2 additions & 2 deletions build/parsePreamble.c → build/parsePreamble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <rpm/rpmlog.h>
#include <rpm/rpmurl.h>
#include <rpm/rpmfileutil.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"
#include "debug.h"

#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; }
Expand Down
6 changes: 3 additions & 3 deletions build/parsePrep.c → build/parsePrep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <rpm/header.h>
#include <rpm/rpmlog.h>
#include <rpm/rpmfileutil.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmmacro_internal.h"
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"
#include "rpmmacro_internal.hh"
#include "debug.h"

static void appendMb(rpmMacroBuf mb, const char *s, int nl)
Expand Down
4 changes: 2 additions & 2 deletions build/parseReqs.c → build/parseReqs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <ctype.h>
#include <rpm/rpmtypes.h>
#include <rpm/rpmlog.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"
#include "debug.h"


Expand Down
10 changes: 5 additions & 5 deletions build/parseScript.c → build/parseScript.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include <rpm/header.h>
#include <rpm/rpmlog.h>

#include "rpmlua.h"
#include "rpmscript.h" /* script flags */
#include "rpmtriggers.h" /* default priority */
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmlua.hh"
#include "rpmscript.hh" /* script flags */
#include "rpmtriggers.hh" /* default priority */
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"

#include "debug.h"

Expand Down
2 changes: 1 addition & 1 deletion build/parseSimpleScript.c → build/parseSimpleScript.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "system.h"

#include <rpm/rpmlog.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"


Expand Down
4 changes: 2 additions & 2 deletions build/parseSpec.c → build/parseSpec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <rpm/rpmts.h>
#include <rpm/rpmlog.h>
#include <rpm/rpmfileutil.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_misc.h"
#include "rpmbuild_internal.hh"
#include "rpmbuild_misc.hh"
#include "debug.h"

#define SKIPSPACE(s) { while (*(s) && risspace(*(s))) (s)++; }
Expand Down
4 changes: 2 additions & 2 deletions build/policies.c → build/policies.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include <rpm/rpmlog.h>
#include <rpm/rpmbase64.h>

#include "rpmio_internal.h"
#include "rpmbuild_internal.h"
#include "rpmio_internal.hh"
#include "rpmbuild_internal.hh"

#include "debug.h"

Expand Down
2 changes: 1 addition & 1 deletion build/reqprov.c → build/reqprov.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <rpm/header.h>
#include <rpm/rpmstring.h>
#include <rpm/rpmlog.h>
#include "rpmbuild_internal.h"
#include "rpmbuild_internal.hh"
#include "debug.h"

int addReqProv(Package pkg, rpmTagVal tagN,
Expand Down
4 changes: 2 additions & 2 deletions build/rpmbuild_internal.h → build/rpmbuild_internal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <rpm/rpmbuild.h>
#include <rpm/rpmutil.h>
#include <rpm/rpmstrpool.h>
#include "rpmbuild_misc.h"
#include "rpmlua.h"
#include "rpmbuild_misc.hh"
#include "rpmlua.hh"

using fileRenameHash = std::unordered_multimap<std::string,std::string>;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions build/rpmfc.c → build/rpmfc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <rpm/rpmfi.h>
#include <rpm/rpmstrpool.h>

#include "rpmfi_internal.h" /* rpmfiles stuff for now */
#include "rpmbuild_internal.h"
#include "rpmfi_internal.hh" /* rpmfiles stuff for now */
#include "rpmbuild_internal.hh"

#include "debug.h"

Expand Down
4 changes: 2 additions & 2 deletions build/spec.c → build/spec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <rpm/rpmlog.h>
#include <rpm/rpmfileutil.h>

#include "rpmfi_internal.h" /* rpmfiles stuff */
#include "rpmbuild_internal.h"
#include "rpmfi_internal.hh" /* rpmfiles stuff */
#include "rpmbuild_internal.hh"

#include "debug.h"

Expand Down
4 changes: 2 additions & 2 deletions build/speclua.c → build/speclua.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

#include "system.h"

#include "rpmlua.h"
#include "rpmbuild_internal.h"
#include "rpmlua.hh"
#include "rpmbuild_internal.hh"

#include "debug.h"

Expand Down
62 changes: 23 additions & 39 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,64 +21,48 @@ target_include_directories(librpm
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
# This is needed for rpmcli.h
# This is needed for rpmcli.hh
${POPT_INCLUDE_DIRS}
)

target_sources(librpm PRIVATE
backend/dbi.c backend/dbi.h backend/dummydb.c
backend/dbiset.c backend/dbiset.h
headerutil.c header.c headerfmt.c header_internal.h
rpmdb.c rpmdb_internal.h
fprint.c fprint.h tagname.c rpmtd.c tagtbl.inc
cpio.c cpio.h depends.c order.c formats.c tagexts.c fsm.c fsm.h
manifest.c manifest.h package.c
poptALL.c poptI.c poptQV.c psm.c query.c
rpmal.c rpmal.h rpmchecksig.c rpmds.c rpmds_internal.h
rpmfi.c rpmfi_internal.h
rpmgi.h rpmgi.c rpminstall.c rpmts_internal.h
rpmlead.c rpmlead.h rpmps.c rpmprob.c rpmrc.c
rpmte.c rpmte_internal.h rpmts.c rpmfs.h rpmfs.c
signature.c signature.h transaction.c
verify.c rpmlock.c rpmlock.h misc.h relocation.c
rpmscript.h rpmscript.c
rpmchroot.c rpmchroot.h
rpmplugins.c rpmplugins.h rpmug.c rpmug.h
rpmtriggers.h rpmtriggers.c rpmvs.c rpmvs.h
backend/dbi.cc backend/dbi.hh backend/dummydb.cc
backend/dbiset.cc backend/dbiset.hh
headerutil.cc header.cc headerfmt.cc header_internal.hh
rpmdb.cc rpmdb_internal.hh
fprint.cc fprint.hh tagname.cc rpmtd.cc tagtbl.inc
cpio.cc cpio.hh depends.cc order.cc formats.cc tagexts.cc fsm.cc fsm.hh
manifest.cc manifest.hh package.cc
poptALL.cc poptI.cc poptQV.cc psm.cc query.cc
rpmal.cc rpmal.hh rpmchecksig.cc rpmds.cc rpmds_internal.hh
rpmfi.cc rpmfi_internal.hh
rpmgi.hh rpmgi.cc rpminstall.cc rpmts_internal.hh
rpmlead.cc rpmlead.hh rpmps.cc rpmprob.cc rpmrc.cc
rpmte.cc rpmte_internal.hh rpmts.cc rpmfs.hh rpmfs.cc
signature.cc signature.hh transaction.cc
verify.cc rpmlock.cc rpmlock.hh misc.hh relocation.cc
rpmscript.hh rpmscript.cc
rpmchroot.cc rpmchroot.hh
rpmplugins.cc rpmplugins.hh rpmug.cc rpmug.hh
rpmtriggers.hh rpmtriggers.cc rpmvs.cc rpmvs.hh
)

if(ENABLE_SQLITE)
target_sources(librpm PRIVATE backend/sqlite.c)
target_sources(librpm PRIVATE backend/sqlite.cc)
target_link_libraries(librpm PRIVATE PkgConfig::SQLITE)
endif()

if(ENABLE_NDB)
target_sources(librpm PRIVATE
backend/ndb/glue.c
backend/ndb/glue.cc
backend/ndb/rpmpkg.c backend/ndb/rpmpkg.h
backend/ndb/rpmidx.c backend/ndb/rpmidx.h
backend/ndb/rpmxdb.c backend/ndb/rpmxdb.h
)
endif()

# sources converted to c++ so far (avoid having to do everything at once)
set (cxx_sources
cpio.c depends.c formats.c fprint.c fsm.c header.c
headerfmt.c headerutil.c manifest.c order.c package.c
poptALL.c poptI.c poptQV.c psm.c
query.c relocation.c rpmal.c rpmchecksig.c rpmchroot.c
rpmdb.c rpmds.c rpmfi.c rpmfs.c rpmgi.c rpminstall.c
rpmlead.c rpmlock.c rpmplugins.c rpmprob.c rpmps.c
rpmrc.c rpmscript.c rpmtd.c rpmte.c rpmtriggers.c
rpmts.c rpmug.c rpmvs.c signature.c tagexts.c tagname.c
transaction.c verify.c
backend/dbi.c backend/dbiset.c backend/bdb_ro.c
backend/dummydb.c backend/sqlite.c backend/ndb/glue.c
)
set_source_files_properties(${cxx_sources} PROPERTIES LANGUAGE CXX)

if(ENABLE_BDB_RO)
target_sources(librpm PRIVATE backend/bdb_ro.c)
target_sources(librpm PRIVATE backend/bdb_ro.cc)
endif()

if(WITH_ACL)
Expand Down
2 changes: 1 addition & 1 deletion lib/backend/bdb_ro.c → lib/backend/bdb_ro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <fcntl.h>
#include <errno.h>

#include "rpmdb_internal.h"
#include "rpmdb_internal.hh"
#include <rpm/rpmstring.h>
#include <rpm/rpmlog.h>

Expand Down
2 changes: 1 addition & 1 deletion lib/backend/dbi.c → lib/backend/dbi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <rpm/rpmmacro.h>
#include <rpm/rpmlog.h>
#include <rpm/header.h>
#include "rpmdb_internal.h"
#include "rpmdb_internal.hh"
#include "debug.h"

const struct rpmdbOps_s *backends[] = {
Expand Down
2 changes: 1 addition & 1 deletion lib/backend/dbi.h → lib/backend/dbi.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <unordered_map>

#include <stdio.h>
#include "dbiset.h"
#include "dbiset.hh"
#include <rpm/rpmtag.h>

/* XXX: make this backend-specific, eliminate or something... */
Expand Down
2 changes: 1 addition & 1 deletion lib/backend/dbiset.c → lib/backend/dbiset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <string.h>
#include <stdlib.h>
#include "dbiset.h"
#include "dbiset.hh"
#include "debug.h"

using std::vector;
Expand Down
File renamed without changes.
Loading

0 comments on commit 6a7284f

Please sign in to comment.