From b64a0d0b1cc1f990a61e3729d9a9ed548318b7b8 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Thu, 8 Oct 2020 18:02:41 -0700 Subject: [PATCH 1/4] integrate legacy build with newer toolchains Signed-off-by: Stephen L Arnold --- Makefile | 6 +++--- Makefile.test | 4 ++-- mcstrip.l | 1 - test-base.txt | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 05c23ee..133ac2e 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ DBG ?= -g OPTIM ?= -O2 LFLAGS = -t MYLDFLAGS = $(LDFLAGS) $(DBG) -MYCFLAGS = $(OPTIM) $(DBG) $(CFLAGS) #-Wall +MYCFLAGS = -D_DEFAULT_SOURCE $(OPTIM) $(DBG) $(CFLAGS) #-Wall MYCXXFLAGS = $(MYCFLAGS) LDADD = -lstdc++ -lfl @@ -46,8 +46,8 @@ LDADD = -lstdc++ -lfl .SUFFIXES: .l .c .C .o GENSRCS = mcstrip.c scan.c -BLDSRCS = lib.C main.C strerror.c -MCSOBJS = mcstrip.o strerror.o +BLDSRCS = lib.C main.C +MCSOBJS = mcstrip.o CYCOBJS = main.o lib.o SCNOBJS = scan.o diff --git a/Makefile.test b/Makefile.test index d270133..3a155ba 100644 --- a/Makefile.test +++ b/Makefile.test @@ -28,8 +28,8 @@ LDADD = -lstdc++ -lfl .SUFFIXES: .o .c .C .l GENSRCS = mcstrip.c scan.c -BLDSRCS = lib.C main.C strerror.c -MCSOBJS = mcstrip.o strerror.o +BLDSRCS = lib.C main.C +MCSOBJS = mcstrip.o CYCOBJS = main.o lib.o SCNOBJS = scan.o diff --git a/mcstrip.l b/mcstrip.l index e4ba9c1..dd0beb2 100644 --- a/mcstrip.l +++ b/mcstrip.l @@ -36,7 +36,6 @@ extern int getopt(); #include #include -#include "strerror.h" /* this aren't declared yet */ int yylex(); diff --git a/test-base.txt b/test-base.txt index 35cbf82..fca05d1 100644 --- a/test-base.txt +++ b/test-base.txt @@ -1,4 +1,4 @@ -intmain 2 +intminn 2 staticintf1 8 Total complexity: 10 From 99de234b1388724fac2b2c7f6e11b2bf00aef940 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Thu, 8 Oct 2020 20:24:18 -0700 Subject: [PATCH 2/4] enable compiler warnings, fix clang volatile warnings Signed-off-by: Stephen L Arnold --- Makefile | 2 +- list.h | 2 +- stack.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 133ac2e..7acbf3d 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ DBG ?= -g OPTIM ?= -O2 LFLAGS = -t MYLDFLAGS = $(LDFLAGS) $(DBG) -MYCFLAGS = -D_DEFAULT_SOURCE $(OPTIM) $(DBG) $(CFLAGS) #-Wall +MYCFLAGS = -D_DEFAULT_SOURCE $(OPTIM) $(DBG) $(CFLAGS) -Wall MYCXXFLAGS = $(MYCFLAGS) LDADD = -lstdc++ -lfl diff --git a/list.h b/list.h index 4b0deeb..a4f3fe8 100644 --- a/list.h +++ b/list.h @@ -24,7 +24,7 @@ third party claims) arising therefrom. // NOTE: _LIST_CLASSTYPE should be a text only single token. Use typedefs. #ifndef COREDUMP -#define COREDUMP *((char*)0)=0 // causes a segmentation fault (only under UNIX) +#define COREDUMP *((volatile char*)0)=0 // causes a segmentation fault (only under UNIX) #endif #ifndef _LIST_CLASSNAME diff --git a/stack.h b/stack.h index 865aac3..9bb7645 100644 --- a/stack.h +++ b/stack.h @@ -23,7 +23,7 @@ third party claims) arising therefrom. // NOTE: _STACK_TYPE should be a text only single token. Use typedefs. #ifndef COREDUMP -#define COREDUMP *((char*)0)=0 // causes a segmentation fault (only under UNIX) +#define COREDUMP *((volatile char*)0)=0 // causes a segmentation fault (only under UNIX) #endif #ifndef _STACK_CLASSNAME From 670a349c9266efac626248540987fe3988ea6036 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Thu, 8 Oct 2020 23:29:59 -0700 Subject: [PATCH 3/4] test-base.txt: restored expected result (still needs fix) Signed-off-by: Stephen L Arnold --- test-base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-base.txt b/test-base.txt index fca05d1..35cbf82 100644 --- a/test-base.txt +++ b/test-base.txt @@ -1,4 +1,4 @@ -intminn 2 +intmain 2 staticintf1 8 Total complexity: 10 From 72cec687852d29004b8fd8bc6e749c296c05e227 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Mon, 10 Apr 2023 10:36:05 -0700 Subject: [PATCH 4/4] add left-over makefile changes; still needs proper strerror integration) * bump ci workflow to newer ubuntu version Signed-off-by: Stephen L Arnold --- .github/workflows/ci.yml | 4 ++-- Makefile | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d8ab13..61b9756 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,10 +17,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] + os: [ubuntu-22.04] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add 64-bit mingw-w64 to the PATH run: | echo "c:/msys64/bin;c:/msys64/mingw64/bin" >> $GITHUB_PATH diff --git a/Makefile b/Makefile index 7acbf3d..048541b 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ DBG ?= -g OPTIM ?= -O2 LFLAGS = -t MYLDFLAGS = $(LDFLAGS) $(DBG) -MYCFLAGS = -D_DEFAULT_SOURCE $(OPTIM) $(DBG) $(CFLAGS) -Wall +MYCFLAGS = -D_GNU_SOURCE $(OPTIM) $(DBG) $(CFLAGS) -ansi -Wall MYCXXFLAGS = $(MYCFLAGS) LDADD = -lstdc++ -lfl @@ -117,9 +117,7 @@ install-targets: make-install-dirs $(INSTALL_DATA) mccabe.example $(DOCDIR) clean: - $(RM) cyclo mcstrip core *.o *~ + $(RM) cyclo mcstrip core *.o *~ *.metrics *.preproc *.stripped cleanall: clean $(RM) $(GENSRCS) - -