Skip to content

Commit

Permalink
Merge branch 'rj/sparse'
Browse files Browse the repository at this point in the history
* rj/sparse:
  sparse: Fix some "symbol not declared" warnings
  sparse: Fix errors due to missing target-specific variables
  sparse: Fix an "symbol 'merge_file' not decared" warning
  sparse: Fix an "symbol 'format_subject' not declared" warning
  sparse: Fix some "Using plain integer as NULL pointer" warnings
  sparse: Fix an "symbol 'cmd_index_pack' not declared" warning
  Makefile: Use cgcc rather than sparse in the check target
  • Loading branch information
gitster committed Apr 27, 2011
2 parents 982f6c9 + c514772 commit 793066e
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 30 deletions.
53 changes: 33 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ GCOV = gcov

export TCL_PATH TCLTK_PATH

# sparse is architecture-neutral, which means that we need to tell it
# explicitly what architecture to check for. Fix this up for yours..
SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
SPARSE_FLAGS =



Expand Down Expand Up @@ -527,6 +525,7 @@ LIB_H += list-objects.h
LIB_H += ll-merge.h
LIB_H += log-tree.h
LIB_H += mailmap.h
LIB_H += merge-file.h
LIB_H += merge-recursive.h
LIB_H += notes.h
LIB_H += notes-cache.h
Expand Down Expand Up @@ -924,6 +923,7 @@ ifeq ($(uname_O),Cygwin)
X = .exe
COMPAT_OBJS += compat/cygwin.o
UNRELIABLE_FSTAT = UnfortunatelyYes
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
endif
ifeq ($(uname_S),FreeBSD)
NEEDS_LIBICONV = YesPlease
Expand Down Expand Up @@ -1177,6 +1177,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
EXTLIBS += -lws2_32
PTHREAD_LIBS =
X = .exe
SPARSE_FLAGS = -Wno-one-bit-signed-bitfield
ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
htmldir=doc/git/html/
prefix =
Expand Down Expand Up @@ -1580,6 +1581,7 @@ ifndef V
QUIET_LNCP = @echo ' ' LN/CP $@;
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
QUIET_GCOV = @echo ' ' GCOV $@;
QUIET_SP = @echo ' ' SP $<;
QUIET_SUBDIR0 = +@subdir=
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
$(MAKE) $(PRINT_DIR) -C $$subdir
Expand Down Expand Up @@ -1675,17 +1677,17 @@ strip: $(PROGRAMS) git$X
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X

git.o: common-cmds.h
git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
git.sp git.s git.o: EXTRA_CPPFLAGS = -DGIT_VERSION='"$(GIT_VERSION)"' \
'-DGIT_HTML_PATH="$(htmldir_SQ)"'

git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)

help.o: common-cmds.h
help.sp help.o: common-cmds.h

builtin/help.o: common-cmds.h
builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
builtin/help.sp builtin/help.o: common-cmds.h
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"'
Expand Down Expand Up @@ -1971,30 +1973,34 @@ $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
test-svn-fe.o: vcs-svn/svndump.h
endif

exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
exec_cmd.sp exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
'-DBINDIR="$(bindir_relative_SQ)"' \
'-DPREFIX="$(prefix_SQ)"'

builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
builtin/init-db.sp builtin/init-db.s builtin/init-db.o: EXTRA_CPPFLAGS = \
-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'

config.s config.o: EXTRA_CPPFLAGS = -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
config.sp config.s config.o: EXTRA_CPPFLAGS = \
-DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'

attr.s attr.o: EXTRA_CPPFLAGS = -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
attr.sp attr.s attr.o: EXTRA_CPPFLAGS = \
-DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'

http.s http.o: EXTRA_CPPFLAGS = -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
http.sp http.s http.o: EXTRA_CPPFLAGS = \
-DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'

ifdef NO_EXPAT
http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
endif

ifdef NO_REGEX
compat/regex/regex.o: EXTRA_CPPFLAGS = -DGAWK -DNO_MBSUPPORT
compat/regex/regex.sp compat/regex/regex.o: EXTRA_CPPFLAGS = \
-DGAWK -DNO_MBSUPPORT
endif

ifdef USE_NED_ALLOCATOR
compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
-DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
endif

Expand Down Expand Up @@ -2160,13 +2166,20 @@ test-%$X: test-%.o $(GITLIBS)
check-sha1:: test-sha1$X
./test-sha1.sh

SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ))

$(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
$(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \
$(SPARSE_FLAGS) $<

.PHONY: sparse $(SP_OBJ)
sparse: $(SP_OBJ)

check: common-cmds.h
if sparse; \
@if sparse; \
then \
for i in $(patsubst %.o, %.c, $(GIT_OBJS)); \
do \
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
done; \
echo 2>&1 "Use 'make sparse' instead"; \
$(MAKE) --no-print-directory sparse; \
else \
echo 2>&1 "Did you mean 'make test'?"; \
exit 1; \
Expand Down
4 changes: 2 additions & 2 deletions attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,15 @@ static void drop_attr_stack(void)
}
}

const char *git_etc_gitattributes(void)
static const char *git_etc_gitattributes(void)
{
static const char *system_wide;
if (!system_wide)
system_wide = system_path(ETC_GITATTRIBUTES);
return system_wide;
}

int git_attr_system(void)
static int git_attr_system(void)
{
return !git_env_bool("GIT_ATTR_NOSYSTEM", 0);
}
Expand Down
2 changes: 1 addition & 1 deletion builtin/index-pack.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "cache.h"
#include "builtin.h"
#include "delta.h"
#include "pack.h"
#include "csum-file.h"
Expand Down
3 changes: 1 addition & 2 deletions builtin/merge-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "xdiff-interface.h"
#include "blob.h"
#include "exec_cmd.h"
#include "merge-file.h"

static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
static int resolve_directories = 1;
Expand Down Expand Up @@ -54,8 +55,6 @@ static const char *explanation(struct merge_list *entry)
return "removed in remote";
}

extern void *merge_file(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);

static void *result(struct merge_list *entry, unsigned long *size)
{
enum object_type type;
Expand Down
3 changes: 0 additions & 3 deletions builtin/shortlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ static int compare_by_number(const void *a1, const void *a2)
return -1;
}

const char *format_subject(struct strbuf *sb, const char *msg,
const char *line_separator);

static void insert_one_record(struct shortlog *log,
const char *author,
const char *oneline)
Expand Down
2 changes: 2 additions & 0 deletions commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ extern char *logmsg_reencode(const struct commit *commit,
extern char *reencode_commit_message(const struct commit *commit,
const char **encoding_p);
extern void get_commit_format(const char *arg, struct rev_info *);
extern const char *format_subject(struct strbuf *sb, const char *msg,
const char *line_separator);
extern void userformat_find_requirements(const char *fmt, struct userformat_want *w);
extern void format_commit_message(const struct commit *commit,
const char *format, struct strbuf *sb,
Expand Down
4 changes: 2 additions & 2 deletions imap-send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,13 +1193,13 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
if (!preauth) {
#ifndef NO_OPENSSL
if (!srvc->use_ssl && CAP(STARTTLS)) {
if (imap_exec(ctx, 0, "STARTTLS") != RESP_OK)
if (imap_exec(ctx, NULL, "STARTTLS") != RESP_OK)
goto bail;
if (ssl_socket_connect(&imap->buf.sock, 1,
srvc->ssl_verify))
goto bail;
/* capabilities may have changed, so get the new capabilities */
if (imap_exec(ctx, 0, "CAPABILITY") != RESP_OK)
if (imap_exec(ctx, NULL, "CAPABILITY") != RESP_OK)
goto bail;
}
#endif
Expand Down
1 change: 1 addition & 0 deletions merge-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "xdiff-interface.h"
#include "ll-merge.h"
#include "blob.h"
#include "merge-file.h"

static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
{
Expand Down
7 changes: 7 additions & 0 deletions merge-file.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef MERGE_FILE_H
#define MERGE_FILE_H

extern void *merge_file(const char *path, struct blob *base, struct blob *our,
struct blob *their, unsigned long *size);

#endif
1 change: 1 addition & 0 deletions vcs-svn/svndump.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "line_buffer.h"
#include "string_pool.h"
#include "strbuf.h"
#include "svndump.h"

/*
* Compare start of string to literal of equal length;
Expand Down

0 comments on commit 793066e

Please sign in to comment.