Merge branch 'rj/sparse'

* 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
maint
Junio C Hamano 2011-04-27 11:36:42 -07:00
commit 793066e790
10 changed files with 50 additions and 30 deletions

View File

@ -323,9 +323,7 @@ GCOV = gcov


export TCL_PATH TCLTK_PATH export TCL_PATH TCLTK_PATH


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






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


git.o: common-cmds.h 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)"' '-DGIT_HTML_PATH="$(htmldir_SQ)"'


git$X: git.o $(BUILTIN_OBJS) $(GITLIBS) git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \ $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS) $(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.sp builtin/help.o: common-cmds.h
builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \ '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
'-DGIT_MAN_PATH="$(mandir_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_SQ)"' \
'-DGIT_INFO_PATH="$(infodir_SQ)"' '-DGIT_INFO_PATH="$(infodir_SQ)"'
@ -1971,30 +1973,34 @@ $(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
test-svn-fe.o: vcs-svn/svndump.h test-svn-fe.o: vcs-svn/svndump.h
endif 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)"' \ '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
'-DBINDIR="$(bindir_relative_SQ)"' \ '-DBINDIR="$(bindir_relative_SQ)"' \
'-DPREFIX="$(prefix_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)"' -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 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 endif


ifdef NO_REGEX 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 endif


ifdef USE_NED_ALLOCATOR 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 -DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
endif endif


@ -2160,13 +2166,20 @@ test-%$X: test-%.o $(GITLIBS)
check-sha1:: test-sha1$X check-sha1:: test-sha1$X
./test-sha1.sh ./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 check: common-cmds.h
if sparse; \ @if sparse; \
then \ then \
for i in $(patsubst %.o, %.c, $(GIT_OBJS)); \ echo 2>&1 "Use 'make sparse' instead"; \
do \ $(MAKE) --no-print-directory sparse; \
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
done; \
else \ else \
echo 2>&1 "Did you mean 'make test'?"; \ echo 2>&1 "Did you mean 'make test'?"; \
exit 1; \ exit 1; \

4
attr.c
View File

@ -465,7 +465,7 @@ static void drop_attr_stack(void)
} }
} }


const char *git_etc_gitattributes(void) static const char *git_etc_gitattributes(void)
{ {
static const char *system_wide; static const char *system_wide;
if (!system_wide) if (!system_wide)
@ -473,7 +473,7 @@ const char *git_etc_gitattributes(void)
return system_wide; return system_wide;
} }


int git_attr_system(void) static int git_attr_system(void)
{ {
return !git_env_bool("GIT_ATTR_NOSYSTEM", 0); return !git_env_bool("GIT_ATTR_NOSYSTEM", 0);
} }

View File

@ -1,4 +1,4 @@
#include "cache.h" #include "builtin.h"
#include "delta.h" #include "delta.h"
#include "pack.h" #include "pack.h"
#include "csum-file.h" #include "csum-file.h"

View File

@ -3,6 +3,7 @@
#include "xdiff-interface.h" #include "xdiff-interface.h"
#include "blob.h" #include "blob.h"
#include "exec_cmd.h" #include "exec_cmd.h"
#include "merge-file.h"


static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>"; static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
static int resolve_directories = 1; static int resolve_directories = 1;
@ -54,8 +55,6 @@ static const char *explanation(struct merge_list *entry)
return "removed in remote"; 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) static void *result(struct merge_list *entry, unsigned long *size)
{ {
enum object_type type; enum object_type type;

View File

@ -29,9 +29,6 @@ static int compare_by_number(const void *a1, const void *a2)
return -1; return -1;
} }


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

static void insert_one_record(struct shortlog *log, static void insert_one_record(struct shortlog *log,
const char *author, const char *author,
const char *oneline) const char *oneline)

View File

@ -90,6 +90,8 @@ extern char *logmsg_reencode(const struct commit *commit,
extern char *reencode_commit_message(const struct commit *commit, extern char *reencode_commit_message(const struct commit *commit,
const char **encoding_p); const char **encoding_p);
extern void get_commit_format(const char *arg, struct rev_info *); 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 userformat_find_requirements(const char *fmt, struct userformat_want *w);
extern void format_commit_message(const struct commit *commit, extern void format_commit_message(const struct commit *commit,
const char *format, struct strbuf *sb, const char *format, struct strbuf *sb,

View File

@ -1193,13 +1193,13 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
if (!preauth) { if (!preauth) {
#ifndef NO_OPENSSL #ifndef NO_OPENSSL
if (!srvc->use_ssl && CAP(STARTTLS)) { if (!srvc->use_ssl && CAP(STARTTLS)) {
if (imap_exec(ctx, 0, "STARTTLS") != RESP_OK) if (imap_exec(ctx, NULL, "STARTTLS") != RESP_OK)
goto bail; goto bail;
if (ssl_socket_connect(&imap->buf.sock, 1, if (ssl_socket_connect(&imap->buf.sock, 1,
srvc->ssl_verify)) srvc->ssl_verify))
goto bail; goto bail;
/* capabilities may have changed, so get the new capabilities */ /* 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; goto bail;
} }
#endif #endif

View File

@ -3,6 +3,7 @@
#include "xdiff-interface.h" #include "xdiff-interface.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "blob.h" #include "blob.h"
#include "merge-file.h"


static int fill_mmfile_blob(mmfile_t *f, struct blob *obj) static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
{ {

7
merge-file.h Normal file
View File

@ -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

View File

@ -13,6 +13,7 @@
#include "line_buffer.h" #include "line_buffer.h"
#include "string_pool.h" #include "string_pool.h"
#include "strbuf.h" #include "strbuf.h"
#include "svndump.h"


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