Skip to contentSkip to conversation

sparse on MinGW

PATCH In review Ramsay Jones 1 participant 1 message May 21, 2013 Sparse checker

lore
Share & tools
lore
#0 lore raw

cover sparse on MinGW

Hi Chris,

As I mentioned before, I ported sparse to MinGW four years ago, but have not posted the patches here yet because they need some "tidy up" work.

Well, I still haven't done the tidy-up, but I have decided to post them anyway! :-D

Actually, only the first four patches are really about porting to MinGW; the final patch just happens to fix a problem while running sparse over git on MinGW (compat/nedmalloc/nedmalloc.c to be precise).

Patch #1 adds the __restrict__ keyword, which is used often in the system headers.

Patch #2 actually adds support for MinGW to cgcc. Note that this only adds support for 32-bit systems. I don't have access to a 64-bit system, but I suspect this would require additional changes to support 64-bit.

Patch #3 fixes all of the compilation errors/warnings. This is mostly fixing up "format specifiers" (e.g. "%llx") which gcc on MinGW does not understand. Fixing the format specifiers involves using the macros in the <inttypes.h> header file. However, this patch addresses other issues, which are mostly marked by the use of "#if !defined(__MINGW32__)" conditional blocks, and is the reason for not submitting earlier.

Patch #4 allows the test-suite to run on MinGW. [The original version of these patches actually used calls to _setmode() to set _O_BINARY mode for stdout and stderr so that sparse output used LF line endings, rather than CRLF.]

ATB,
Ramsay Jones

Ramsay Jones (5):
Add the __restrict__ keyword
Add support for the MinGW platform
Fix some "unknown format" warnings
test-suite: Add -b option to ignore CR at eol on MinGW lib.c: Add __sync_lock_test_and_set as a builtin function

 cgcc                  | 13 +++++++++++++
 compile-i386.c        |  7 ++++---
 example.c             |  7 ++++---
 expand.c              |  5 +++--
 ident-list.h          |  2 +-
 lib.c                 |  1 +
 linearize.c           | 15 ++++++++++-----
 parse.c               |  6 ++++--
 pre-process.c         |  7 ++++++-
 show-parse.c          | 15 ++++++++++-----
 sparse.c              |  3 ++-
 tokenize.c            |  4 ++--
 validation/reserved.c |  1 +
 validation/test-suite |  2 +-
 14 files changed, 62 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.2