Skip to content

No warnings with a C or C++ compiler#85

Open
c-kloukinas wants to merge 3 commits intonimble-code:masterfrom
c-kloukinas:use-c++-compiler
Open

No warnings with a C or C++ compiler#85
c-kloukinas wants to merge 3 commits intonimble-code:masterfrom
c-kloukinas:use-c++-compiler

Conversation

@c-kloukinas
Copy link
Copy Markdown

Aim: Code improvements (no compilation warnings)/Porting to C++.

To compile with a C++ compiler, one now has to set both CC & CXX to be that compiler, like env CC=g++ CXX=${CC} make

For another project I'm planing I need to use a C++ compiler to compile Spin.

So as a first step I tried to

  1. make it possible to compile with a C++ compiler, and
  2. eliminate all compilation warnings with either a C or a C++ compiler.

For (1.), I mainly had to rename SeqList's field Sequence *this to Sequence *thisS and change static FSM_trans *explicit to static FSM_trans *explicit_ptr, since this and explicit are reserved words in C++.
But there were also issues with some C warnings, that C++ treats as errors.

Therefore I also attempted (2.), to eliminate all compilation warnings under both C and C++. This mainly entailed adding const to function parameters. In some cases I also replaced plain static char arrays with strdup of them.

When considering the changes, please set it so that whitespace changes are ignored (there are quite few of these unfortunately, as my editor is set to replace tabs and delete end-of-line whitespace before saving - really sorry for this).

I hope that this PR will help improve the code's robustness and make it easier to spot errors in future updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant