Skip to content

Commit

Permalink
getting started with clang static analysis in lib-src
Browse files Browse the repository at this point in the history
  • Loading branch information
cooljeanius committed Nov 23, 2023
1 parent 1c97017 commit ab9e250
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib-src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ pop.s

# profiling:
gmon.out

# static analysis output:
clang_static_analysis/*
21 changes: 21 additions & 0 deletions lib-src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ PROFILING_CFLAGS = @PROFILING_CFLAGS@
WARN_CFLAGS = @WARN_CFLAGS@
WARN_LDFLAGS = @WARN_LDFLAGS@
WERROR_CFLAGS = @WERROR_CFLAGS@
BETTER_DEBUG_CFLAGS = @BETTER_DEBUG_CFLAGS@

PRE_WARNING_TESTING_CFLAGS = @PRE_WARNING_TESTING_CFLAGS@

CLANG_ANALYZER = @CLANG_ANALYZER@

RUN_CLANG_ANALYZER = $(CLANG_ANALYZER) $(PRE_WARNING_TESTING_CFLAGS) \
$(DEFS) $(CPPFLAGS) $(MYCPPFLAGS) -DDEBUG -D_DEBUG \
-Dlint -I. -I.. -I../src -I../lib-src -idirafter ../lib \
--analyze

UPDATE_MANIFEST = @UPDATE_MANIFEST@

LIBRARY_PATH = @LIBRARY_PATH@
Expand Down Expand Up @@ -106,6 +117,10 @@ localstatedir=@localstatedir@
srcdir=@srcdir@
VPATH=@srcdir@

# Where build output is put.
builddir = @builddir@
analysisdir = $(builddir)/clang_static_analysis

# The top-level source directory, also set by configure.
top_srcdir=@top_srcdir@
# MinGW CPPFLAGS may use this.
Expand Down Expand Up @@ -641,4 +656,10 @@ xveterm${EXEEXT}: ${srcdir}/emacstool.c
tcp${EXEEXT}: ${srcdir}/tcp.c
cc -O -o tcp tcp.c -DFUJITSU_UTS -lu -lsocket

## Apple stuff:
.SUFFIXES: .c .plist
.c.plist:
@if test ! -d $(analysisdir); then $(MKDIR_P) $(analysisdir); fi
$(RUN_CLANG_ANALYZER) -Wall -Wextra -o $(analysisdir)/$@ $<

## Makefile ends here.
4 changes: 2 additions & 2 deletions lib-src/etags.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ static const struct option longopts[] =
{ "no-globals", no_argument, &globals, 0 },
{ "include", required_argument, NULL, 'i' },
#endif
{ NULL }
{ NULL, no_argument, NULL, 0 }
};

static compressor compressors[] =
Expand All @@ -505,7 +505,7 @@ static compressor compressors[] =
{ "GZ", "gzip -d -c"},
{ "bz2", "bzip2 -d -c" },
{ "xz", "xz -d -c" },
{ NULL }
{ NULL, NULL }
};

/*
Expand Down
7 changes: 6 additions & 1 deletion src/regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@
#if defined _LIBC
# define WIDE_CHAR_SUPPORT 1
#else
# define WIDE_CHAR_SUPPORT \
# if defined(emacs)
# define WIDE_CHAR_SUPPORT \
(HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC && !emacs)
# else
# define WIDE_CHAR_SUPPORT \
(HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
# endif /* emacs */
#endif /* _LIBC */

/* For platform which support the ISO C amendment 1 functionality we
Expand Down

0 comments on commit ab9e250

Please sign in to comment.