diff options
author | 2022-05-21 17:16:50 +0200 | |
---|---|---|
committer | 2022-05-22 01:16:50 +1000 | |
commit | 324f9d44d5c4293645e7bb8f42e7d95d5ac1e604 (patch) | |
tree | 1ad2d66458486f184e11536e247309eb6c0161fb /src/lib/netlist/build | |
parent | b33946d980772bf8e973b3816684f313a5b4e9ea (diff) |
netlist: More c++, less macros, added support for cspell (#9794)
- More c++, less macros
* Significantly reduced the use of unused_var and replaced it with
[[maybe_unused]]
* use enum class in ppmf.h
- Changes to testing code in ptest.h
* Catch exceptions in more places
* The verbosity of the output can now be controlled
* Display of test stats totals
- added support for cspell
- fixed various typos
- fixed SUBTARGET=nl build
- fixed more file permissions
- srcclean and add fix_permissions target to netlist makefile
Diffstat (limited to 'src/lib/netlist/build')
-rw-r--r-- | src/lib/netlist/build/cspell.json | 76 | ||||
-rw-r--r-- | src/lib/netlist/build/makefile | 64 |
2 files changed, 127 insertions, 13 deletions
diff --git a/src/lib/netlist/build/cspell.json b/src/lib/netlist/build/cspell.json new file mode 100644 index 00000000000..d1035e868d4 --- /dev/null +++ b/src/lib/netlist/build/cspell.json @@ -0,0 +1,76 @@ +{ +"words" : [ + "MAME", + "netlist", + "netlists", + "datasheet", + "cmos", + "opamp", + "opamps", + "mosfet", + "mosfets", + "Chebyshev", + "Fairchild", + "Schmitt", + "Transconductance", + "nmos", + "pmos", + "retriggerable", // not in leo + "presettable", // not in leo + "misformatted", // not in leo + "monostable", + "demultiplexer", + "demultiplexers", + "behavioural", + "highpass", + "nltool", + "nvcc", + "Couriersud", + "plib", // FIXME: Remove everything below here again + "ppmf" +], +"languageSettings": [ + // This one works with Python + { + "languageId": "python", + "includeRegExpList": [ + "/#.*/", + "/('''|\"\"\")[^\\1]+?\\1/g", + "strings" + ] + }, + // This one works with JavaScript, Typescript, etc + { + "languageId": "javascript,typescript", + "includeRegExpList": [ + "CStyleComment", + "strings" + ] + }, + // Use with cpp or c files + { + "languageId": "cpp,c,h", + // Turn off compound words, because it is only checking strings. + "allowCompoundWords": false, + // Only check comments and strings + "includeRegExpList": [ + "CStyleComment", + "string" + ], + "ignoreRegExpList": [ + "/#include.*/", // Exclude includes, because they are also strings + "/#pragma.*/", // Exclude pragmas, they may include strings + "/\/\/ NOLINT:.*/", // Exclude clang-tidy instructions + "/\/\/\/ \\\\file.*/", // Doxygen + "/\/\/\/ \\\\addtogroup.*/", // Doxygen + "/`[^`]+`/", // Markup code formatt + "/} \/\/ namespace.*/", // Namespace comments + "/[A-Z][A-Z][A-Z][^\\s]*/", // Identifiers starting with at least 3 capital letters + // Project specific exclusions start here + "/\/\/ copyright-holders.*/", + "/\/\/- Pinalias:/", + "/\/\/#.*/" // commented source code + ] + } +] +} diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index b44ed3e727e..fab68ed5a0b 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -111,7 +111,7 @@ TIDY_DB = $(OBJ)/compile_commands.json #LTO decreases performance :-( #LTO = -flto=4 -fuse-linker-plugin -Wodr -CCOREFLAGS = -g -O3 -std=c++17 -I$(SRC) +CCOREFLAGS = -g -O3 -std=c++17 -I$(SRC) -I$(SRC)/.. CFLAGS = $(LTO) $(CCOREFLAGS) $(CEXTRAFLAGS) LDFLAGS = $(LTO) -g -O3 -std=c++17 $(LDEXTRAFLAGS) @@ -172,6 +172,16 @@ CORESOURCES := \ MAINSOURCES = $(SRC)/prg/nltool.cpp $(SRC)/prg/nlwav.cpp +HEADERS = $(wildcard $(SRC)/analog/*.h) +HEADERS += $(wildcard $(SRC)/core/*.h) +HEADERS += $(wildcard $(SRC)/devices/*.h) +HEADERS += $(wildcard $(SRC)/solver/*.h) +HEADERS += $(wildcard $(SRC)/tools/*.h) +HEADERS += $(wildcard $(SRC)/*.h) +HEADERS += $(wildcard $(SRC)/generated/*.h) + +PHEADERS = $(wildcard $(SRC)/plib/*.h) + PSOURCES := \ $(PSRC)/pstring.cpp \ $(PSRC)/pdynlib.cpp \ @@ -191,15 +201,18 @@ TESTOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(TESTSOURCES:.cpp=.o)) MAINOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(MAINSOURCES:.cpp=.o)) POBJS = $(patsubst $(SRC)%, $(OBJ)%, $(PSOURCES:.cpp=.o)) -OBJS = $(POBJS) $(NLOBJS) $(NLDEVOBJS) $(TESTOBJS) +OBJS = $(TESTOBJS) $(POBJS) $(NLOBJS) $(NLDEVOBJS) $(TESTOBJS) + +VSFILES = \ + $(VSBUILD)/netlistlib.vcxproj \ + $(VSBUILD)/netlistlib.vcxproj.filters \ + $(VSBUILD)/nltool.vcxproj \ + $(VSBUILD)/nltool.vcxproj.filters \ + $(VSBUILD)/nlwav.vcxproj \ + $(VSBUILD)/nlwav.vcxproj.filters \ + $(VSBUILD)/netlist.sln \ -VSBUILDS = \ - $(VSBUILD/netlistlib.vcxproj) \ - $(VSBUILD/netlistlib.vcxproj.user \ - $(VSBUILD/nltool.vcxproj \ - $(VSBUILD/netlistlib.vcxproj.filters \ - $(VSBUILD/nltool.vcxproj.filters \ - $(VSBUILD/netlist.sln \ +OTHERFILES = makefile DOCS = \ doxygen.conf \ @@ -213,7 +226,8 @@ ALL_OBJS = $(OBJS) $(MAINOBJS) ALL_TIDY_FILES = $(ALL_OBJS:.o=.json) ALLSOURCES = $(DEVSOURCES) $(CORESOURCES) $(TESTSOURCES) $(MAINSOURCES) $(PSOURCES) -ALLFILES = $(ALLSOURCES) $(VSBUILDS) $(DOCS) +ALLHEADERS = $(HEADERS) $(PHEADERS) +ALLFILES = $(ALLSOURCES) $(VSFILES) $(DOCS) $(OTHERFILES) MAKEFILE_TARGETS_WITHOUT_INCLUDE := \ clang clang-5 clang-libc gcc9 mingw native nvcc \ @@ -270,10 +284,10 @@ maketree: $(sort $(BUILD_DIRS)) #------------------------------------------------- native: - $(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra " + $(MAKE) CEXTRAFLAGS="-march=native -msse4.2 -Wall -Wpedantic -Wsign-compare -Wextra" gcc9: - $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -Wall -pedantic -Wpedantic -fext-numeric-literals -Wsign-compare -Wextra" EXTRALIBS="-lquadmath" + $(MAKE) CC=g++-9 LD=g++-9 CEXTRAFLAGS="-march=native -Wall -pedantic -Wpedantic -fext-numeric-literals -Wsign-compare -Wextra" EXTRALIBS="-lquadmath" OBJ=obj/gcc9 emsdk: emmake $(MAKE) CC=emcc LD=emcc CEXTRAFLAGS="-fexceptions" LDEXTRAFLAGS="-fexceptions --emrun" OBJ=obj/emsdk EXESUFFIX=.html @@ -311,7 +325,7 @@ clang-libc: nvcc: $(MAKE) CC=/usr/local/cuda-11.3/bin/nvcc LD=/usr/local/cuda-11.3/bin/nvcc \ - OBJ=obj/nvcc CEXTRAFLAGS="--std c++17 -x cu -DNVCCBUILD=113 --expt-extended-lambda \ + OBJ=obj/nvcc CEXTRAFLAGS="--std c++17 -x cu --expt-extended-lambda \ --expt-relaxed-constexpr --default-stream per-thread --restrict \ --ftemplate-depth 1024 \ -Xcompiler -O6 -Xcompiler -march=native -ccbin g++-9 " \ @@ -322,6 +336,12 @@ mingw: -DWIN32_LEAN_AND_MEAN" LDEXTRAFLAGS="-Wl,--subsystem,console \ -municode" LIBS= MD=@mkdir.exe SHELL=sh.exe DOXYGEN=doxygen.exe $(PARAMS) +mingw-cross: + ${MAKE} CC="x86_64-w64-mingw32-g++-posix" LD="x86_64-w64-mingw32-g++-posix" \ + CEXTRAFLAGS="-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN" \ + LDEXTRAFLAGS="-Wl,--subsystem,console -municode" OBJ=obj/mingw-cross \ + EXESUFFIX=.exe LIBS= + #------------------------------------------------- # regression tests #------------------------------------------------- @@ -343,6 +363,10 @@ doc: ./nltool$(EXESUFFIX) -c docheader > ../documentation/devsyn.dox.h $(DOXYGEN) doxygen.conf +NLOBJS = $(patsubst $(SRC)%, $(OBJ)%, $(CORESOURCES:.cpp=.o)) +cspell: + cd .. && cspell -c build/cspell.json --no-color --relative $(patsubst $(SRC)/%, %, $(ALLHEADERS) $(ALLSOURCES)) | sed -e "s/ - Unknown/: error: Unknown/g" + #------------------------------------------------- # depends #------------------------------------------------- @@ -384,6 +408,20 @@ $(SRC)/generated/nlm_modules_lib.cpp: $(MODULESOURCES) generated: $(SRC)/generated/lib_entries.hxx $(SRC)/generated/nld_devinc.h $(SRC)/generated/nlm_modules_lib.cpp #------------------------------------------------- +# fix permissions, source management +#------------------------------------------------- + +fix_permissions: + @find .. -executable -and -not -type d -print | grep -v /build | xargs -r chmod a-x + @chmod a-x $(ALLFILES) + @find .. -print | xargs setfacl -b + +srcclean: $(ALLSOURCES) $(ALLHEADERS) + @../../../../srcclean -u $(ALLSOURCES) $(ALLHEADERS) + +precommit: fix_permissions srcclean + +#------------------------------------------------- # clang tidy #------------------------------------------------- |