Start compiling with `-Wsign-compare`
Re: [PATCH v2 07/14] global: trivial conversions to fix `-Wsign-compare` warnings
In reply to Patrick SteinhardtQuoted 19 lines · Patrick Steinhardt
pkt-line.c +0
-3@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "copy.h" #include "pkt-line.h" @@ -41,7 +39,6 @@ static int packet_trace_pack(const char *buf, unsigned int len, int sideband)static void packet_trace (const char *buf,unsigned int len,int write) { -int i;struct strbuf out;static int in_pack, sideband;
pkt-line.c static void packet_trace(const char *buf, unsigned int len, int write) · line 77
Quoted 8 lines
pkt-line.c +1
-1@@ -74,7 +71,7 @@ static void packet_trace(const char *buf, unsigned int len, int write) get_trace_prefix(), write ? '>' : '<');/* XXX we should really handle printable utf8 */ -for (i =0 ; i < len; i++) { +for (unsigned int i =0 ; i < len; i++) {/* suppress newlines */ if (buf[i] =='\n' )continue ;
This unfortunately is not enough for 32-bit architectures.
As the helper is limited to handle only 64kB worth of data, "size" being "unsigned" is more than sufficiently wide even on 32-bit box, and a variable of type ssize_t is still wide enough, but the compilers would not know that.
I do not have a 32-bit box handy, so this is not tested in the target environment the fix aims at, but at least I tested to make sure it does not break 64-bit builds.
It seems that csum-file.c has a similar issue, but I haven't had a chance to take a look.
pkt-line.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
pkt-line.c +4 -3
@@ -339,7 +339,7 @@ int write_packetized_from_buf_no_flush_count(const char *src_in, size_t len,static int get_packet_data (int fd,char **src_buf,size_t *src_size,void *dst,unsigned size,int options) { -ssize_t ret; +size_t ret;if (fd >=0 && src_buf && *src_buf)BUG ("multiple sources given to packet_read" );
@@ -351,12 +351,13 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, *src_buf += ret; *src_size -= ret; }else { - ret =read_in_full (fd, dst, size); -if (ret <0 ) { +ssize_t num_read =read_in_full (fd, dst, size); +if (num_read <0 ) {if (options &PACKET_READ_GENTLE_ON_READ_ERROR )return error_errno (_ ("read error" ));die_errno (_ ("read error" )); } + ret = num_read; }/* And complain if we didn't get enough bytes to satisfy the read. */
PATCH v2 8/14 daemon: fix loops that have mismatching integer types
In reply to Patrick SteinhardtWe have several loops in "daemon.c" that use a signed integer to loop through a size_t. Adapt them to instead use a size_t as counter value.
--- daemon.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
daemon.c +8 -13
@@ -503,8 +503,7 @@ static struct daemon_service daemon_service[] = {static void enable_service (const char *name,int ena) { -int i; -for (i =0 ; i <ARRAY_SIZE (daemon_service); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (daemon_service); i++) {if (!strcmp (daemon_service[i].name, name)) { daemon_service[i].enabled = ena;return ;
@@ -515,8 +514,7 @@ static void enable_service(const char *name, int ena)static void make_service_overridable (const char *name,int ena) { -int i; -for (i =0 ; i <ARRAY_SIZE (daemon_service); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (daemon_service); i++) {if (!strcmp (daemon_service[i].name, name)) { daemon_service[i].overridable = ena;return ;
@@ -737,7 +735,7 @@ static void set_keep_alive(int sockfd)static int execute (void ) {char *line = packet_buffer; -int pktlen, len, i; +int pktlen, len;char *addr =getenv ("REMOTE_ADDR" ), *port =getenv ("REMOTE_PORT" );struct hostinfo hi =HOSTINFO_INIT ;struct strvec env =STRVEC_INIT ;
@@ -758,7 +756,7 @@ static int execute(void)if (len != pktlen)parse_extra_args (&hi, &env, line + len +1 , pktlen - len -1 ); -for (i =0 ; i <ARRAY_SIZE (daemon_service); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (daemon_service); i++) {struct daemon_service *s = &(daemon_service[i]);const char *arg;
@@ -1108,8 +1106,8 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct sif (!listen_addr->nr)setup_named_sock (NULL , listen_port, socklist);else { -int i, socknum; -for (i =0 ; i < listen_addr->nr; i++) { +int socknum; +for (size_t i =0 ; i < listen_addr->nr; i++) { socknum =setup_named_sock (listen_addr->items[i].string, listen_port, socklist);
@@ -1123,11 +1121,10 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct sstatic int service_loop (struct socketlist *socklist) {struct pollfd *pfd; -int i;CALLOC_ARRAY (pfd, socklist->nr); -for (i =0 ; i < socklist->nr; i++) { +for (size_t i =0 ; i < socklist->nr; i++) { pfd[i].fd = socklist->list[i]; pfd[i].events =POLLIN ; }
@@ -1135,8 +1132,6 @@ static int service_loop(struct socketlist *socklist)signal (SIGCHLD , child_handler);for (;;) { -int i; -check_dead_children ();if (poll (pfd, socklist->nr,-1 ) <0 ) {
@@ -1148,7 +1143,7 @@ static int service_loop(struct socketlist *socklist)continue ; } -for (i =0 ; i < socklist->nr; i++) { +for (size_t i =0 ; i < socklist->nr; i++) {if (pfd[i].revents &POLLIN ) { union { struct sockaddr sa;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v2 9/14 daemon: fix type of `max_connections`
In reply to Patrick SteinhardtThe max_connections type tracks how many children git-daemon(1) would spawn at the same time. This value can be controlled via a command line
switch: if given a positive value we'll set that up as the limit. But when given either zero or a negative value we don't enforce any limit at all.
But even when being passed a negative value we won't actually store it, but normalize it to 0. Still, the variable used to store the config is using a signed integer, which causes warnings when comparing the number of accepted connections (max_connections) with the number of current connections being handled (live_children).
Adapt the type of max_connections such that the types of both variables match.
--- daemon.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
daemon.c +5 -6
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
@@ -801,8 +800,7 @@ static int addrcmp(const struct sockaddr_storage *s1,return 0 ; } -static int max_connections =32 ; - +static unsigned int max_connections =32 ;static unsigned int live_children; static struct child {
@@ -1315,10 +1313,11 @@ int cmd_main(int argc, const char **argv)continue ; }if (skip_prefix (arg,"--max-connections=" , &v)) { -if (strtol_i (v,10 , &max_connections)) +int parsed_value; +if (strtol_i (v,10 , &parsed_value))die (_ ("invalid max-connections '%s', expecting an integer" ), v); -if (max_connections <0 ) - max_connections =0 ;/* unlimited */ +/* A negative value indicates unlimited children. */ + max_connections = parsed_value <0 ?0 : parsed_value;continue ; }if (!strcmp (arg,"--strict-paths" )) {
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v2 10/14 gpg-interface: address -Wsign-comparison warnings
In reply to Patrick SteinhardtThere are a couple of -Wsign-comparison warnings in "gpg-interface.c". Most of them are trivial and simply using signed integers to loop towards an upper unsigned bound.
But in parse_signed_buffer() we have one case where the different signedness of the two values of a ternary expression results in a warning. Given that:
- size will always be bigger than len due to the loop condition.
- eol will always be after buf + len because it is found via memchr(3p) starting from buf + len.
We know that both values will always be natural integers.
Squelch the warning by casting the left-hand side to size_t.
--- gpg-interface.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
gpg-interface.c +6 -9
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
@@ -128,9 +127,7 @@ static struct gpg_format *use_format = &gpg_format[0];static struct gpg_format *get_format_by_name (const char *str) { -int i; - -for (i =0 ; i <ARRAY_SIZE (gpg_format); i++) +for (size_t i =0 ; i <ARRAY_SIZE (gpg_format); i++)if (!strcmp (gpg_format[i].name, str))return gpg_format + i;return NULL ;
@@ -138,9 +135,9 @@ static struct gpg_format *get_format_by_name(const char *str)static struct gpg_format *get_format_by_sig (const char *sig) { -int i, j; +int j; -for (i =0 ; i <ARRAY_SIZE (gpg_format); i++) +for (size_t i =0 ; i <ARRAY_SIZE (gpg_format); i++)for (j =0 ; gpg_format[i].sigs[j]; j++)if (starts_with (sig, gpg_format[i].sigs[j]))return gpg_format + i;
@@ -228,7 +225,7 @@ static void parse_gpg_output(struct signature_check *sigc) {const char *buf = sigc->gpg_status;const char *line, *next; -int i, j; +int j;int seen_exclusive_status =0 ;/* Iterate over all lines */
@@ -243,7 +240,7 @@ static void parse_gpg_output(struct signature_check *sigc)continue ;/* Iterate over all search strings */ -for (i =0 ; i <ARRAY_SIZE (sigcheck_gpg_status); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (sigcheck_gpg_status); i++) {if (skip_prefix (line, sigcheck_gpg_status[i].check, &line)) {/* * GOODSIG, BADSIG etc. can occur only once for
@@ -700,7 +697,7 @@ size_t parse_signed_buffer(const char *buf, size_t size) match = len; eol =memchr (buf + len,'\n' , size - len); - len += eol ? eol - (buf + len) +1 : size - len; + len += eol ? (size_t ) (eol - (buf + len) +1 ) : size - len; }return match; }
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v2 11/14 builtin/blame: fix type of `length` variable when emitting object ID
In reply to Patrick SteinhardtThe length variable is used to store how many bytes we wish to emit from an object ID. This value will either be the full hash algorithm's length, or the abbreviated hash that can be set via --abbrev or the "core.abbrev" option. The former is of type size_t, whereas the latter is of type int, which causes a warning with "-Wsign-compare".
The reason why abbrev is using a signed type is mostly that it is initialized with -1 to indicate that we have to compute the minimum abbreviation length. This length is computed via find_alignment(), which always gets called before emit_other(), and thus we can assume that the value would never be negative in emit_other().
In fact, we can even assume that the value will always be at least MINIMUM_ABBREV, which is enforced by both git_default_core_config() and parse_opt_abbrev_cb(). We implicitly rely on this by subtracting up to 3 without checking for whether the value becomes negative. We then pass the value to printf(3p) to print the prefix of our object's ID, so if that assumption was violated we may end up with undefined behaviour.
Squelch the warning by asserting this invariant and casting the value of abbrev to size_t. This allows us to store the whole length as an unsigned integer, which we can then pass to fwrite().
--- builtin/blame.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
builtin/blame.c +7 -3
@@ -6,7 +6,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -468,9 +467,14 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int reset =GIT_COLOR_RESET ; } +if (abbrev <MINIMUM_ABBREV ) +BUG ("abbreviation is smaller than minimum length: %d < %d" , + abbrev,MINIMUM_ABBREV ); +for (cnt =0 ; cnt < ent->num_lines; cnt++) {char ch; -int length = (opt &OUTPUT_LONG_OBJECT_NAME ) ? the_hash_algo->hexsz : abbrev; +size_t length = (opt &OUTPUT_LONG_OBJECT_NAME ) ? + the_hash_algo->hexsz : (size_t ) abbrev;if (opt &OUTPUT_COLOR_LINE ) {if (cnt >0 ) {
@@ -501,7 +505,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int length--;putchar ('?' ); } -printf ("%.*s" , length, hex); +fwrite (hex,1 , length, stdout);if (opt &OUTPUT_ANNOTATE_COMPAT ) {const char *name;if (opt &OUTPUT_SHOW_EMAIL )
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v2 12/14 builtin/patch-id: fix type of `get_one_patchid()`
In reply to Patrick SteinhardtIn get_one_patchid() we assign either the result of strlen() or remove_space() to len. But while the former correctly returns a size_t, the latter returns an int to indicate the length of the string even though it cannot ever return a negative value. This causes a warning with "-Wsign-conversion".
In fact, even get_one_patchid() itself is also using an integer as return value even though it always returns the length of the patch, and this bubbles up to other callers.
Adapt the function and its helpers to use size_t for string lengths consistently.
--- builtin/patch-id.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
builtin/patch-id.c +8 -8
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -10,13 +9,13 @@#include "parse-options.h" #include "setup.h" -static void flush_current_id (int patchlen,struct object_id *id,struct object_id *result) +static void flush_current_id (size_t patchlen,struct object_id *id,struct object_id *result) {if (patchlen)printf ("%s %s\n" ,oid_to_hex (result),oid_to_hex (id)); } -static int remove_space (char *line) +static size_t remove_space (char *line) {char *src = line;char *dst = line;
@@ -63,10 +62,11 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after)return 1 ; } -static int get_one_patchid (struct object_id *next_oid,struct object_id *result, -struct strbuf *line_buf,int stable,int verbatim) +static size_t get_one_patchid (struct object_id *next_oid,struct object_id *result, +struct strbuf *line_buf,int stable,int verbatim) { -int patchlen =0 , found_next =0 ; +size_t patchlen =0 ; +int found_next =0 ;int before =-1 , after =-1 ;int diff_is_binary =0 ;char pre_oid_str[GIT_MAX_HEXSZ +1 ], post_oid_str[GIT_MAX_HEXSZ +1 ];
@@ -78,7 +78,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,while (strbuf_getwholeline (line_buf, stdin,'\n' ) !=EOF ) {char *line = line_buf->buf;const char *p = line; -int len; +size_t len;/* Possibly skip over the prefix added by "log" or "format-patch" */ if (!skip_prefix(line, "commit ", &p) &&
@@ -179,7 +179,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,static void generate_id_list (int stable,int verbatim) {struct object_id oid, n, result; -int patchlen; +size_t patchlen;struct strbuf line_buf =STRBUF_INIT ;oidclr (&oid, the_repository->hash_algo);
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
Re: [PATCH v2 12/14] builtin/patch-id: fix type of `get_one_patchid()`
Quoted 3 lines · Patrick Steinhardt
In
get_one_patchid()we assign either the result ofstrlen()orremove_space()tolen. But while the former correctly returns asize_t, the latter returns anintto indicate the length of the
It is a little misleading about the statement "the latte returns an int to indicate the length of the string".
Should "without spaces" be appended into the last? However, don't worth a reroll.
Quoted 28 lines
string even though it cannot ever return a negative value. This causes a warning with "-Wsign-conversion".
In fact, even
get_one_patchid()itself is also using an integer as return value even though it always returns the length of the patch, and this bubbles up to other callers.Adapt the function and its helpers to use
size_tfor string lengths consistently.Signed-off-by Patrick Steinhardt <[email protected]>--- builtin/patch-id.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)builtin/patch-id.c +0
-1@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h" @@ -10,13 +9,13 @@#include "parse-options.h" #include "setup.h"
builtin/patch-id.c line 18
Quoted 10 lines
builtin/patch-id.c +2
-2-static void flush_current_id (int patchlen,struct object_id *id,struct object_id *result) +static void flush_current_id (size_t patchlen,struct object_id *id,struct object_id *result) {if (patchlen)printf ("%s %s\n" ,oid_to_hex (result),oid_to_hex (id)); } -static int remove_space (char *line) +static size_t remove_space (char *line)
So, eventually, we have decided to change the return type from "int" to "size_t". This avoids casting "int" to "size_t", which is good. And it would be more natural, because "remove_space" never returns negative result.
builtin/patch-id.c line 21
Quoted 3 lines
builtin/patch-id.c +0
-0{char *src = line;char *dst = line;
Thanks,
Jialuo
Re: [PATCH v2 12/14] builtin/patch-id: fix type of `get_one_patchid()`
Quoted 10 lines · shejialuo
Quoted 3 lines · Patrick Steinhardt
In
get_one_patchid()we assign either the result ofstrlen()orremove_space()tolen. But while the former correctly returns asize_t, the latter returns anintto indicate the length of theIt is a little misleading about the statement "the latte returns an
intto indicate the length of the string".Should "without spaces" be appended into the last? However, don't worth a reroll.
I'll say "stripped string" to keep things short. I won't send a reroll just for this, but will send it out if there's going to be a v3 of this series.
Thanks!
Patrick
PATCH v2 13/14 scalar: address -Wsign-compare warnings
In reply to Patrick SteinhardtThere are two -Wsign-compare warnings in "scalar.c", both of which are trivial:
- We mistakenly use a signed integer to loop towards an upper unsigned bound in cmd_reconfigure().
- We subtract path_sep - enlistment->buf, which results in a signed integer, and use the value in a ternary expression where second value is unsigned. But as path_sep is being assigned the result of find_last_dir_sep(enlistment->buf + offset) we know that it must always be bigger than or equal to enlistment->buf, and thus the result will be positive.
Address both of these warnings.
--- scalar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
scalar.c +3 -4
@@ -3,7 +3,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
@@ -380,7 +379,7 @@ static int delete_enlistment(struct strbuf *enlistment) offset =offset_1st_component (enlistment->buf); path_sep =find_last_dir_sep (enlistment->buf + offset);strbuf_add (&parent, enlistment->buf, - path_sep ? path_sep - enlistment->buf : offset); + path_sep ? (size_t ) (path_sep - enlistment->buf) : offset);if (chdir (parent.buf) <0 ) {int res =error_errno (_ ("could not switch to '%s'" ), parent.buf);strbuf_release (&parent);
@@ -655,7 +654,7 @@ static int cmd_reconfigure(int argc, const char **argv)NULL };struct string_list scalar_repos =STRING_LIST_INIT_DUP ; -int i, res =0 ; +int res =0 ;struct strbuf commondir =STRBUF_INIT , gitdir =STRBUF_INIT ; argc = parse_options(argc, argv, NULL, options,
@@ -673,7 +672,7 @@ static int cmd_reconfigure(int argc, const char **argv)git_config (get_scalar_repos, &scalar_repos); -for (i =0 ; i < scalar_repos.nr; i++) { +for (size_t i =0 ; i < scalar_repos.nr; i++) {int succeeded =0 ;struct repository *old_repo, r = {NULL };const char *dir = scalar_repos.items[i].string;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v2 14/14 t/helper: don't depend on implicit wraparound
In reply to Patrick SteinhardtIn our test helpers we have two cases where we assign -1 to an unsigned long. The intent is to essentially mean "unbounded output", which is achieved via implicit wraparound of the value.
This pattern causes warnings with -Wsign-compare though. Adapt it and instead use ULONG_MAX explicitly.
--- t/helper/test-csprng.c | 5 +---- t/helper/test-genrandom.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-)
t/helper/test-csprng.c +1 -4
@@ -1,9 +1,6 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-tool.h" #include "git-compat-util.h" -int cmd__csprng (int argc,const char **argv) {unsigned long count;
@@ -14,7 +11,7 @@ int cmd__csprng(int argc, const char **argv)return 2 ; } - count = (argc ==2 ) ?strtoul (argv[1 ],NULL ,0 ) :-1L ; + count = (argc ==2 ) ?strtoul (argv[1 ],NULL ,0 ) :ULONG_MAX ;while (count) {unsigned long chunk = count <sizeof (buf) ? count :sizeof (buf);
t/helper/test-genrandom.c +1 -3
@@ -4,8 +4,6 @@* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2. */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-tool.h" #include "git-compat-util.h"
@@ -24,7 +22,7 @@ int cmd__genrandom(int argc, const char **argv) next = next *11 + *c; }while (*c++); - count = (argc ==3 ) ?strtoul (argv[2 ],NULL ,0 ) :-1L ; + count = (argc ==3 ) ?strtoul (argv[2 ],NULL ,0 ) :ULONG_MAX ;while (count--) { next = next *1103515245 +12345 ;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
Quoted 33 lines · Patrick Steinhardt
Hi,
when compiling with DEVELOPER=YesPlease, we explicitly disable the "-Wsign-compare" warning. This is mostly because our code base is full of cases where we don't bother at all whether something should be signed or unsigned, and enabling the warning would thus cause tons of warnings to pop up.
Unfortunately, disabling this warning also masks real issues. There have been multiple CVEs in the Git project that would have been flagged by this warning (e.g. CVE-2022-39260, CVE-2022-41903 and several fixes in the vicinity of these CVEs). Furthermore, the final audit report by X41 D-Sec, who are the ones who have discovered some of the CVEs, hinted that it might be a good idea to become more strict in this context.
Now simply enabling the warning globally does not fly due to the stated reason above that we simply have too many sites where we use the wrong integer types. Instead, this patch series introduces a new macro that allows us to explicitly mark files that generate such warnings. Like this, we can adapt the codebase over time and hopefully make this class of vulnerabilities harder to land.
Changes in v2:
- Explode the 6th patch into multiple patches with more careful analysis and refactorings
- Drop the conversion of "
gettext.c". To do it properly we'd have to fix the return type ofutf8_strwidth(), which we have already marked as a todo.- Link to v1: https://lore.kernel.org/r/[email protected]
Quoted 8 lines
There are a couple of trivial conflicts with kn/midx-wo-the-repository, but I don't think it makes sense to make that a dependency of this sereis. Let me know in case you disagree and I'll change the base of this series.
Thanks!
Patrick
The range-diff looks good to me.
PATCH 1/1 sign-compare: 32-bit support
In reply to Patrick SteinhardtOn 32-bit platforms, ssize_t may be "int" while size_t may be "unsigned int". At times we compare the number of bytes we read stored in a ssize_t variable with "unsigned int", but that is done after we check that we did not get an error return (which is negative---and that is the whole reason why we used ssize_t and not size_t), so these comparisons are safe.
But compilers may not realize that. Cast these to size_t to work around the false positives. On platforms with size_t/ssize_t wider than a normal int, this won't be an issue.
---
* These were needed to make linux32 CI job compile the -Wsign-compare topic cleanly.
csum-file.c | 2 +- pkt-line.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
csum-file.c +1 -1
@@ -23,7 +23,7 @@ static void verify_buffer_or_die(struct hashfile *f,if (ret <0 )die_errno ("%s: sha1 file read error" , f->name); -if (ret != count) +if ((size_t )ret != (size_t )count)die ("%s: sha1 file truncated" , f->name);if (memcmp (buf, f->check_buffer, count))die ("sha1 file '%s' validation error" , f->name);
pkt-line.c +1 -1
@@ -360,7 +360,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, }/* And complain if we didn't get enough bytes to satisfy the read. */ -if (ret != size) { +if ((size_t )ret != (size_t )size) {if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ;
Signature · 1 line
2.47.1-574-g3b2d6bb55a
Re: [PATCH] sign-compare: 32-bit support
Quoted 10 lines · Junio C Hamano
On 32-bit platforms,
ssize_tmay be "int" whilesize_tmay be "unsigned int". At times we compare the number of bytes we read stored in assize_tvariable with "unsigned int", but that is done after we check that we did not get an error return (which is negative---and that is the whole reason why we usedssize_tand notsize_t), so these comparisons are safe.But compilers may not realize that. Cast these to
size_tto work around the false positives. On platforms with size_t/ssize_t wider than a normal int, this won't be an issue.
Thanks for the patch! Will include in v3.
Patrick
v3 cover Start compiling with `-Wsign-compare`
In reply to Patrick SteinhardtHi,
when compiling with DEVELOPER=YesPlease, we explicitly disable the "-Wsign-compare" warning. This is mostly because our code base is full of cases where we don't bother at all whether something should be signed or unsigned, and enabling the warning would thus cause tons of warnings to pop up.
Unfortunately, disabling this warning also masks real issues. There have been multiple CVEs in the Git project that would have been flagged by this warning (e.g. CVE-2022-39260, CVE-2022-41903 and several fixes in the vicinity of these CVEs). Furthermore, the final audit report by X41 D-Sec, who are the ones who have discovered some of the CVEs, hinted that it might be a good idea to become more strict in this context.
Now simply enabling the warning globally does not fly due to the stated reason above that we simply have too many sites where we use the wrong integer types. Instead, this patch series introduces a new macro that allows us to explicitly mark files that generate such warnings. Like this, we can adapt the codebase over time and hopefully make this class of vulnerabilities harder to land.
Changes in v2:
- Explode the 6th patch into multiple patches with more careful analysis and refactorings
- Drop the conversion of "gettext.c". To do it properly we'd have to fix the return type of utf8_strwidth(), which we have already marked as a todo.
- Link to v1: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Include Junio's fix for 32 bit platforms.
- Improve a commit message.
- Link to v2: https://lore.kernel.org/r/[email protected]
There are a couple of trivial conflicts with kn/midx-wo-the-repository, but I don't think it makes sense to make that a dependency of this sereis. Let me know in case you disagree and I'll change the base of this series.
Thanks!
Patrick
---
Junio C Hamano (1):
sign-compare: 32-bit support
Patrick Steinhardt (14):
git-compat-util: introduce macros to disable "-Wsign-compare" warnings compat/regex: explicitly ignore "-Wsign-compare" warnings compat/win32: fix -Wsign-compare warning in "wWinMain()"
global: mark code units that generate warnings with -Wsign-compare config.mak.dev: drop -Wno-sign-compare
diff.h: fix index used to loop through unsigned integer
global: trivial conversions to fix -Wsign-compare warnings
daemon: fix loops that have mismatching integer types
daemon: fix type of max_connections
gpg-interface: address -Wsign-comparison warnings builtin/blame: fix type of length variable when emitting object ID builtin/patch-id: fix type of get_one_patchid()
scalar: address -Wsign-compare warnings
t/helper: don't depend on implicit wraparound
add-interactive.c | 1 + add-patch.c | 1 + advice.c | 7 ++----- apply.c | 1 + archive.c | 1 + attr.c | 1 + base85.c | 3 +-- bisect.c | 1 + blame.c | 1 + bloom.c | 2 ++ builtin/add.c | 9 +++++---- builtin/am.c | 1 + builtin/bisect.c | 2 ++ builtin/blame.c | 11 +++++++++-- builtin/branch.c | 2 ++ builtin/cat-file.c | 3 +++ builtin/checkout--worker.c | 2 ++ builtin/checkout-index.c | 3 +++ builtin/checkout.c | 2 ++ builtin/clean.c | 3 +++ builtin/clone.c | 3 +++ builtin/commit.c | 3 +++ builtin/describe.c | 2 ++ builtin/diff-files.c | 3 +++ builtin/diff-index.c | 2 ++ builtin/diff-tree.c | 1 + builtin/diff.c | 3 +++ builtin/difftool.c | 5 ++++- builtin/fast-export.c | 3 +++ builtin/fast-import.c | 2 ++ builtin/fetch-pack.c | 2 ++ builtin/fetch.c | 3 +++ builtin/for-each-repo.c | 5 +++-- builtin/fsmonitor--daemon.c | 2 ++ builtin/gc.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 6 +++--- builtin/index-pack.c | 2 ++ builtin/log.c | 3 +++ builtin/ls-files.c | 3 +++ builtin/mailsplit.c | 6 ++++-- builtin/merge-file.c | 2 ++ builtin/merge-index.c | 2 ++ builtin/merge-ours.c | 2 ++ builtin/merge-tree.c | 6 +++--- builtin/merge.c | 3 +++ builtin/mv.c | 2 ++ builtin/name-rev.c | 2 ++ builtin/pack-objects.c | 2 ++ builtin/pack-redundant.c | 4 ++-- builtin/pack-refs.c | 1 + builtin/patch-id.c | 16 +++++++++------- builtin/prune.c | 2 ++ builtin/pull.c | 4 ++-- builtin/push.c | 6 ++++-- builtin/range-diff.c | 1 + builtin/rebase.c | 3 +++ builtin/receive-pack.c | 2 ++ builtin/reflog.c | 1 + builtin/remote.c | 2 ++ builtin/repack.c | 2 ++ builtin/replay.c | 4 +++- builtin/rerere.c | 9 +++++---- builtin/reset.c | 2 ++ builtin/rev-list.c | 2 ++ builtin/rev-parse.c | 3 +++ builtin/revert.c | 1 + builtin/rm.c | 3 +++ builtin/shortlog.c | 1 + builtin/show-branch.c | 2 ++ builtin/show-index.c | 2 ++ builtin/sparse-checkout.c | 2 ++ builtin/stash.c | 7 +++---- builtin/submodule--helper.c | 8 ++++---- builtin/tag.c | 3 +++ builtin/unpack-objects.c | 2 ++ builtin/update-index.c | 3 +++ builtin/update-ref.c | 2 ++ builtin/var.c | 5 +++-- builtin/worktree.c | 2 ++ bulk-checkin.c | 1 + bundle-uri.c | 1 + bundle.c | 1 + cache-tree.c | 1 + chunk-format.c | 1 + color.c | 2 ++ column.c | 2 ++ combine-diff.c | 1 + commit-graph.c | 1 + commit-reach.c | 1 + commit.c | 3 +-- compat/fsmonitor/fsm-listen-darwin.c | 3 +-- compat/mingw.c | 1 + compat/poll/poll.c | 2 ++ compat/regex/regex.c | 2 ++ compat/terminal.c | 3 +-- compat/win32/headless.c | 17 +++++++++-------- compat/win32mmap.c | 2 ++ compat/winansi.c | 2 ++ config.c | 1 + config.mak.dev | 1 - connect.c | 1 + convert.c | 1 + credential.c | 1 + csum-file.c | 2 +- daemon.c | 31 +++++++++++++------------------ date.c | 2 ++ decorate.c | 3 +++ delta-islands.c | 1 + diagnose.c | 7 +++---- diff-delta.c | 2 ++ diff-lib.c | 1 + diff-no-index.c | 2 ++ diff.c | 1 + diff.h | 3 +-- diffcore-order.c | 1 + diffcore-pickaxe.c | 3 +++ diffcore-rename.c | 3 +-- diffcore-rotate.c | 1 + dir.c | 1 + entry.c | 4 ++-- ewah/ewah_bitmap.c | 5 ++--- ewah/ewah_io.c | 3 +++ ewah/ewah_rlw.c | 3 +++ fetch-pack.c | 1 + fmt-merge-msg.c | 1 + fsmonitor.c | 1 + gettext.c | 2 ++ git-compat-util.h | 10 ++++++++++ git.c | 20 +++++++------------- gpg-interface.c | 14 ++++++-------- graph.c | 1 + grep.c | 2 ++ help.c | 1 + help.h | 8 +++----- hex.c | 6 ++---- http-backend.c | 1 + http-push.c | 3 +-- http-walker.c | 1 + http.c | 1 + imap-send.c | 1 + json-writer.c | 2 ++ kwset.c | 2 ++ line-log.c | 2 ++ list-objects-filter-options.c | 4 +--- list-objects.c | 7 ++----- log-tree.c | 1 + ls-refs.c | 4 +--- mailinfo.c | 1 + mailmap.c | 1 + match-trees.c | 1 + mem-pool.c | 2 ++ merge-ll.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + merge.c | 4 ++-- midx-write.c | 1 + midx.c | 1 + name-hash.c | 1 + notes-merge.c | 1 + notes.c | 1 + object-file-convert.c | 1 + object-file.c | 1 + object-name.c | 1 + object.c | 1 + pack-bitmap-write.c | 1 + pack-bitmap.c | 1 + pack-check.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + path.c | 4 ++-- pathspec.c | 1 + pkt-line.c | 5 ++--- preload-index.c | 1 + pretty.c | 1 + progress.c | 1 + pseudo-merge.c | 1 + quote.c | 2 ++ range-diff.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog.c | 1 + refs.c | 1 + refs/debug.c | 3 +-- refs/files-backend.c | 1 + refs/iterator.c | 2 ++ refs/packed-backend.c | 1 + refspec.c | 1 + reftable/system.h | 2 ++ remote-curl.c | 1 + remote.c | 1 + rerere.c | 1 + resolve-undo.c | 1 + revision.c | 1 + run-command.c | 1 + scalar.c | 6 +++--- send-pack.c | 5 ++--- sequencer.c | 1 + serve.c | 7 ++----- server-info.c | 1 + setup.c | 1 + shallow.c | 1 + sideband.c | 1 + sparse-index.c | 1 + split-index.c | 1 + strbuf.c | 2 ++ string-list.c | 2 ++ strvec.c | 3 +-- submodule-config.c | 1 + submodule.c | 1 + symlinks.c | 2 ++ t/helper/test-bloom.c | 9 ++------- t/helper/test-cache-tree.c | 1 + t/helper/test-config.c | 1 + t/helper/test-csprng.c | 3 +-- t/helper/test-drop-caches.c | 2 ++ t/helper/test-dump-fsmonitor.c | 3 +-- t/helper/test-dump-split-index.c | 3 +-- t/helper/test-dump-untracked-cache.c | 6 +++--- t/helper/test-genrandom.c | 2 +- t/helper/test-genzeros.c | 2 ++ t/helper/test-hash-speed.c | 5 ++--- t/helper/test-mergesort.c | 2 ++ t/helper/test-parse-options.c | 5 ++--- t/helper/test-path-utils.c | 1 + t/helper/test-reach.c | 3 +-- t/helper/test-ref-store.c | 3 +-- t/helper/test-run-command.c | 2 ++ t/helper/test-string-list.c | 2 ++ t/helper/test-tool.c | 3 +-- t/helper/test-trace2.c | 1 + t/unit-tests/lib-reftable.c | 2 ++ t/unit-tests/t-example-decorate.c | 4 ++-- t/unit-tests/t-prio-queue.c | 2 +- t/unit-tests/t-reftable-readwrite.c | 2 ++ t/unit-tests/t-reftable-stack.c | 2 ++ t/unit-tests/t-trailer.c | 2 ++ t/unit-tests/test-lib.c | 2 ++ tag.c | 1 + tmp-objdir.c | 3 +-- trace.c | 1 + trace2.c | 2 ++ trace2/tr2_sysenv.c | 2 ++ trace2/tr2_tgt_event.c | 2 ++ trace2/tr2_tgt_perf.c | 2 ++ trailer.c | 3 +-- transport-helper.c | 13 ++++++------- transport.c | 13 ++++--------- tree-diff.c | 1 + unix-socket.c | 2 ++ unpack-trees.c | 1 + upload-pack.c | 1 + urlmatch.c | 2 ++ usage.c | 3 ++- userdiff.c | 1 + utf8.c | 2 ++ version.c | 3 +-- versioncmp.c | 3 +-- worktree.c | 1 + wrapper.c | 3 +++ ws.c | 3 +++ wt-status.c | 1 + xdiff-interface.c | 1 + xdiff/xdiffi.c | 1 + xdiff/xinclude.h | 2 ++ 265 files changed, 503 insertions(+), 221 deletions(-)
Range-diff versus v2:
1: c5d30a71fb = 1: f3866ee766 git-compat-util: introduce macros to disable "-Wsign-compare" warnings
2: e320657277 = 2: 5b694e2b06 compat/regex: explicitly ignore "-Wsign-compare" warnings
3: a5b71acdf3 = 3: 2d04ae0627 compat/win32: fix -Wsign-compare warning in "wWinMain()"
4: fdd24ef3dc ! 4: 1ef0944284 global: mark code units that generate warnings with `-Wsign-compare`
@@ credential.c
#include "git-compat-util.h"
#include "abspath.h"
+ ## csum-file.c ##
+@@
+ */
+
+ #define USE_THE_REPOSITORY_VARIABLE
++#define DISABLE_SIGN_COMPARE_WARNINGS
+
+ #include "git-compat-util.h"
+ #include "progress.h"
+
## daemon.c ##
@@
#define USE_THE_REPOSITORY_VARIABLE
5: 547ca812ec = 5: 678673ffc8 config.mak.dev: drop `-Wno-sign-compare`
6: 53615491cd = 6: 5342906326 diff.h: fix index used to loop through unsigned integer
-: ---------- > 7: be0a36edbe sign-compare: 32-bit support
7: 5220623358 = 8: ac39ac5d02 global: trivial conversions to fix `-Wsign-compare` warnings
8: 9096129c17 = 9: c7fbaf15e8 daemon: fix loops that have mismatching integer types
9: add7fca26e = 10: cfb144047d daemon: fix type of `max_connections`
10: ac1cd2564d = 11: 2b8171aa1e gpg-interface: address -Wsign-comparison warnings
11: 6bab14c587 = 12: 2e5bd44217 builtin/blame: fix type of `length` variable when emitting object ID
12: 6b6a63b276 ! 13: ff78b07003 builtin/patch-id: fix type of `get_one_patchid()` @@ Commit message
In get_one_patchid() we assign either the result of strlen() or remove_space() to len. But while the former correctly returns a size_t, the latter returns an int to indicate the length of the
- string even though it cannot ever return a negative value. This causes a
- warning with "-Wsign-conversion".
+ stripped string even though it cannot ever return a negative value. This
+ causes a warning with "-Wsign-conversion".
In fact, even get_one_patchid() itself is also using an integer as return value even though it always returns the length of the patch, and
13: 2a66935837 = 14: 7fab5dd6ab scalar: address -Wsign-compare warnings 14: 8a846a0c13 = 15: 7f02e005ef t/helper: don't depend on implicit wraparound
---
base-commit: cc01bad4a9f566cf4453c7edd6b433851b0835e2
change-id: 20241128-pks-sign-compare-9cf7412bce1a
PATCH v3 1/15 git-compat-util: introduce macros to disable "-Wsign-compare" warnings
When compiling with DEVELOPER=YesPlease, we explicitly disable the "-Wsign-compare" warning. This is mostly because our code base is full of cases where we don't bother at all whether something should be signed or unsigned, and enabling the warning would thus cause tons of warnings to pop up.
Unfortunately, disabling this warning also masks real issues. There have been multiple CVEs in the Git project that would have been flagged by this warning (e.g. CVE-2022-39260, CVE-2022-41903 and several fixes in the vicinity of these CVEs). Furthermore, the final audit report by X41 D-Sec, who are the ones who have discovered some of the CVEs, hinted that it might be a good idea to become more strict in this context.
Now simply enabling the warning globally does not fly due to the stated reason above that we simply have too many sites where we use the wrong integer types. Instead, introduce a new set of macros that allow us to mark a file as being free of warnings with "-Wsign-compare". The mechanism is similar to what we do with USE_THE_REPOSITORY_VARIABLE:
every file that is not marked with DISABLE_SIGN_COMPARE_WARNINGS will be compiled with those warnings enabled.
These new markings will be wired up in the subsequent commits.
--- git-compat-util.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
git-compat-util.h +10 -0
@@ -44,6 +44,16 @@ struct strbuf;#define GIT_GNUC_PREREQ (maj, min) 0#endif +#if defined(__GNUC__) || defined(__clang__) +# define PRAGMA (pragma) _Pragma(#pragma) +# define DISABLE_WARNING (warning) PRAGMA(GCC diagnostic ignored #warning) +#else +# define DISABLE_WARNING (warning) +#endif + +#ifdef DISABLE_SIGN_COMPARE_WARNINGS +DISABLE_WARNING(-Wsign-compare) +#endif #ifndef FLEX_ARRAY /*
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 2/15 compat/regex: explicitly ignore "-Wsign-compare" warnings
In reply to Patrick SteinhardtExplicitly ignore "-Wsign-compare" warnings in our bundled copy of the regcomp implementation. We don't use the macro introduced in the preceding commit because this code does not include "git-compat-util.h" in the first place.
Note that we already directly use "#pragma GCC diagnostic ignored" in "regcomp.c", so it shouldn't be an issue to use it directly in the new spot, either.
--- compat/regex/regex.c | 2 ++ 1 file changed, 2 insertions(+)
compat/regex/regex.c +2 -0
@@ -17,6 +17,8 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#pragma GCC diagnostic ignored "-Wsign-compare" +#ifdef HAVE_CONFIG_H #include "config.h" #endif
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 3/15 compat/win32: fix -Wsign-compare warning in "wWinMain()"
In reply to Patrick SteinhardtGCC generates a warning in "headless.c" because we compare slash with size, where the former is an int and the latter is a size_t. Fix the warning by storing slash as a size_t, as well.
This commit is being singled out because the file does not include the "git-compat-util.h" header, and consequently, we cannot easily mark it with the DISABLE_SIGN_COMPARE_WARNING macro.
--- compat/win32/headless.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
compat/win32/headless.c +9 -8
@@ -53,7 +53,8 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,wchar_t git_command_line[32768 ];size_t size =sizeof (git_command_line) /sizeof (wchar_t);const wchar_t *needs_quotes =L"" ; -int slash =0 , i; +size_t slash =0 ; +int len;STARTUPINFO startup_info = { .cb =sizeof (STARTUPINFO ),
@@ -66,7 +67,7 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,DWORD exit_code;/* First, determine the full path of argv[0] */ -for (i =0 ; _wpgmptr[i]; i++) +for (size_t i =0 ; _wpgmptr[i]; i++)if (_wpgmptr[i] ==L' ' ) needs_quotes =L"\"" ;else if (_wpgmptr[i] ==L'\\' )
@@ -79,16 +80,16 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,extend_path (_wpgmptr, slash);/* Then, add the full path of `git.exe` as argv[0] */ - i =swprintf_s (git_command_line, size,L"%ls%.*ls\\git.exe%ls" , - needs_quotes, slash, _wpgmptr, needs_quotes); -if (i <0 ) + len =swprintf_s (git_command_line, size,L"%ls%.*ls\\git.exe%ls" , + needs_quotes, (int ) slash, _wpgmptr, needs_quotes); +if (len <0 )return 127 ;/* Too long path */ if (*command_line) {/* Now, append the command-line arguments */ - i =swprintf_s (git_command_line + i, size - i, -L" %ls" , command_line); -if (i <0 ) + len =swprintf_s (git_command_line + len, size - len, +L" %ls" , command_line); +if (len <0 )return 127 ; }
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 4/15 global: mark code units that generate warnings with `-Wsign-compare`
In reply to Patrick SteinhardtMark code units that generate warnings with -Wsign-compare. This allows for a structured approach to get rid of all such warnings over time in a way that can be easily measured.
--- add-interactive.c | 1 + add-patch.c | 1 + advice.c | 2 ++ apply.c | 1 + archive.c | 1 + attr.c | 1 + base85.c | 2 ++ bisect.c | 1 + blame.c | 1 + bloom.c | 2 ++ builtin/add.c | 3 +++ builtin/am.c | 2 ++ builtin/bisect.c | 2 ++ builtin/blame.c | 3 +++ builtin/branch.c | 3 +++ builtin/cat-file.c | 3 +++ builtin/checkout--worker.c | 2 ++ builtin/checkout-index.c | 3 +++ builtin/checkout.c | 2 ++ builtin/clean.c | 3 +++ builtin/clone.c | 3 +++ builtin/commit.c | 3 +++ builtin/describe.c | 2 ++ builtin/diff-files.c | 3 +++ builtin/diff-index.c | 2 ++ builtin/diff-tree.c | 2 ++ builtin/diff.c | 3 +++ builtin/difftool.c | 3 +++ builtin/fast-export.c | 3 +++ builtin/fast-import.c | 2 ++ builtin/fetch-pack.c | 2 ++ builtin/fetch.c | 3 +++ builtin/for-each-repo.c | 2 ++ builtin/fsmonitor--daemon.c | 2 ++ builtin/gc.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 4 +++- builtin/index-pack.c | 2 ++ builtin/log.c | 3 +++ builtin/ls-files.c | 3 +++ builtin/mailsplit.c | 3 +++ builtin/merge-file.c | 2 ++ builtin/merge-index.c | 2 ++ builtin/merge-ours.c | 3 +++ builtin/merge-tree.c | 2 ++ builtin/merge.c | 3 +++ builtin/mv.c | 2 ++ builtin/name-rev.c | 2 ++ builtin/pack-objects.c | 2 ++ builtin/pack-redundant.c | 2 ++ builtin/pack-refs.c | 2 ++ builtin/patch-id.c | 2 ++ builtin/prune.c | 2 ++ builtin/pull.c | 2 ++ builtin/push.c | 3 +++ builtin/range-diff.c | 2 ++ builtin/rebase.c | 3 +++ builtin/receive-pack.c | 2 ++ builtin/reflog.c | 2 ++ builtin/remote.c | 2 ++ builtin/repack.c | 2 ++ builtin/replay.c | 4 +++- builtin/rerere.c | 2 ++ builtin/reset.c | 3 +++ builtin/rev-list.c | 2 ++ builtin/rev-parse.c | 3 +++ builtin/revert.c | 2 ++ builtin/rm.c | 3 +++ builtin/shortlog.c | 2 ++ builtin/show-branch.c | 2 ++ builtin/show-index.c | 2 ++ builtin/sparse-checkout.c | 2 ++ builtin/stash.c | 2 ++ builtin/submodule--helper.c | 2 ++ builtin/tag.c | 3 +++ builtin/unpack-objects.c | 2 ++ builtin/update-index.c | 3 +++ builtin/update-ref.c | 2 ++ builtin/var.c | 3 +++ builtin/worktree.c | 2 ++ bulk-checkin.c | 1 + bundle-uri.c | 1 + bundle.c | 1 + cache-tree.c | 1 + chunk-format.c | 1 + color.c | 2 ++ column.c | 2 ++ combine-diff.c | 1 + commit-graph.c | 1 + commit-reach.c | 1 + commit.c | 1 + compat/fsmonitor/fsm-listen-darwin.c | 2 ++ compat/mingw.c | 1 + compat/poll/poll.c | 2 ++ compat/terminal.c | 2 ++ compat/win32mmap.c | 2 ++ compat/winansi.c | 2 ++ config.c | 1 + connect.c | 1 + convert.c | 1 + credential.c | 1 + csum-file.c | 1 + daemon.c | 1 + date.c | 2 ++ decorate.c | 3 +++ delta-islands.c | 1 + diagnose.c | 1 + diff-delta.c | 2 ++ diff-lib.c | 1 + diff-merges.c | 2 ++ diff-no-index.c | 2 ++ diff.c | 1 + diffcore-order.c | 3 +++ diffcore-pickaxe.c | 3 +++ diffcore-rename.c | 1 + diffcore-rotate.c | 3 +++ dir.c | 1 + entry.c | 1 + ewah/ewah_bitmap.c | 3 +++ ewah/ewah_io.c | 3 +++ ewah/ewah_rlw.c | 3 +++ fetch-pack.c | 1 + fmt-merge-msg.c | 1 + fsmonitor.c | 1 + gettext.c | 2 ++ git.c | 1 + gpg-interface.c | 1 + graph.c | 1 + grep.c | 2 ++ help.c | 1 + hex.c | 1 + http-backend.c | 1 + http-push.c | 1 + http-walker.c | 1 + http.c | 1 + imap-send.c | 1 + json-writer.c | 2 ++ kwset.c | 2 ++ line-log.c | 2 ++ list-objects-filter-options.c | 1 + list-objects-filter.c | 1 + list-objects.c | 1 + log-tree.c | 1 + ls-refs.c | 1 + mailinfo.c | 1 + mailmap.c | 1 + match-trees.c | 1 + mem-pool.c | 2 ++ merge-ll.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + merge.c | 1 + midx-write.c | 1 + midx.c | 1 + name-hash.c | 1 + notes-merge.c | 1 + notes.c | 1 + object-file-convert.c | 1 + object-file.c | 1 + object-name.c | 1 + object.c | 1 + pack-bitmap-write.c | 1 + pack-bitmap.c | 1 + pack-check.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + patch-ids.c | 2 ++ path.c | 1 + pathspec.c | 1 + pkt-line.c | 2 ++ preload-index.c | 1 + pretty.c | 1 + progress.c | 1 + pseudo-merge.c | 1 + quote.c | 2 ++ range-diff.c | 1 + reachable.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog-walk.c | 1 + reflog.c | 1 + refs.c | 1 + refs/debug.c | 2 ++ refs/files-backend.c | 1 + refs/iterator.c | 2 ++ refs/packed-backend.c | 1 + refspec.c | 1 + reftable/system.h | 2 ++ remote-curl.c | 1 + remote.c | 1 + rerere.c | 1 + resolve-undo.c | 1 + revision.c | 1 + run-command.c | 1 + scalar.c | 1 + send-pack.c | 1 + sequencer.c | 1 + serve.c | 1 + server-info.c | 1 + setup.c | 1 + shallow.c | 1 + sideband.c | 1 + sparse-index.c | 1 + split-index.c | 1 + strbuf.c | 2 ++ string-list.c | 2 ++ strvec.c | 2 ++ submodule-config.c | 1 + submodule.c | 1 + symlinks.c | 2 ++ t/helper/test-bloom.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-config.c | 1 + t/helper/test-csprng.c | 2 ++ t/helper/test-drop-caches.c | 2 ++ t/helper/test-dump-fsmonitor.c | 1 + t/helper/test-dump-split-index.c | 1 + t/helper/test-dump-untracked-cache.c | 1 + t/helper/test-genrandom.c | 2 ++ t/helper/test-genzeros.c | 2 ++ t/helper/test-hash-speed.c | 2 ++ t/helper/test-mergesort.c | 2 ++ t/helper/test-parse-options.c | 2 ++ t/helper/test-path-utils.c | 1 + t/helper/test-reach.c | 1 + t/helper/test-ref-store.c | 1 + t/helper/test-revision-walking.c | 1 + t/helper/test-run-command.c | 2 ++ t/helper/test-string-list.c | 2 ++ t/helper/test-tool.c | 2 ++ t/helper/test-trace2.c | 1 + t/unit-tests/lib-reftable.c | 2 ++ t/unit-tests/t-example-decorate.c | 1 + t/unit-tests/t-prio-queue.c | 2 ++ t/unit-tests/t-reftable-readwrite.c | 2 ++ t/unit-tests/t-reftable-stack.c | 2 ++ t/unit-tests/t-trailer.c | 2 ++ t/unit-tests/test-lib.c | 2 ++ tag.c | 1 + tmp-objdir.c | 1 + trace.c | 1 + trace2.c | 2 ++ trace2/tr2_sysenv.c | 2 ++ trace2/tr2_tgt_event.c | 2 ++ trace2/tr2_tgt_perf.c | 2 ++ trailer.c | 1 + transport-helper.c | 1 + transport.c | 1 + tree-diff.c | 1 + unix-socket.c | 2 ++ unpack-trees.c | 1 + upload-pack.c | 1 + urlmatch.c | 2 ++ usage.c | 3 +++ userdiff.c | 1 + utf8.c | 2 ++ version.c | 1 + versioncmp.c | 1 + worktree.c | 1 + wrapper.c | 3 +++ ws.c | 3 +++ wt-status.c | 1 + xdiff-interface.c | 1 + xdiff/xdiffi.c | 1 + xdiff/xinclude.h | 2 ++ 265 files changed, 439 insertions(+), 2 deletions(-)
add-interactive.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "add-interactive.h"
add-patch.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "add-interactive.h"
advice.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "advice.h" #include "config.h"
apply.c +1 -0
@@ -8,6 +8,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
archive.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
attr.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
base85.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "base85.h"
bisect.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
blame.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "refs.h"
bloom.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "bloom.h" #include "diff.h"
builtin/add.c +3 -0
@@ -3,6 +3,9 @@* * Copyright (C) 2006 Linus Torvalds */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/am.c +2 -0
@@ -5,6 +5,8 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "advice.h"
builtin/bisect.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "copy.h" #include "environment.h"
builtin/blame.c +3 -0
@@ -4,7 +4,10 @@* Copyright (c) 2006, 2014 by its authors * See COPYING for licensing conditions */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "color.h"
builtin/branch.c +3 -0
@@ -4,7 +4,10 @@* Copyright (c) 2006 Kristian Høgsberg <[email protected]> * Based on git-branch.sh by Junio C Hamano. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "color.h"
builtin/cat-file.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "convert.h"
builtin/checkout--worker.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "entry.h"
builtin/checkout-index.c +3 -0
@@ -4,7 +4,10 @@* Copyright (C) 2005 Linus Torvalds * */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/checkout.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "branch.h"
builtin/clean.c +3 -0
@@ -5,7 +5,10 @@* * Based on git-clean.sh by Pavel Roskin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/clone.c +3 -0
@@ -7,7 +7,10 @@* * Clone a repository into a different directory that does not yet exist. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/commit.c +3 -0
@@ -4,7 +4,10 @@* Copyright (c) 2007 Kristian Høgsberg <[email protected]> * Based on git-commit.sh by Junio C Hamano and Linus Torvalds */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/describe.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "environment.h"
builtin/diff-files.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/diff-index.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/diff-tree.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/diff.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (c) 2006 Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "ewah/ewok.h"
builtin/difftool.c +3 -0
@@ -11,7 +11,10 @@* * Copyright (C) 2016 Johannes Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/fast-export.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) 2007 Johannes E. Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/fast-import.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "environment.h"
builtin/fetch-pack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "hex.h"
builtin/fetch.c +3 -0
@@ -1,7 +1,10 @@/* * "git fetch" */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/for-each-repo.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/fsmonitor--daemon.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/gc.c +3 -0
@@ -9,7 +9,10 @@* * Copyright (c) 2006 Shawn O. Pearce */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "date.h"
builtin/grep.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (c) 2006 Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "gettext.h"
builtin/help.c +3 -1
@@ -1,8 +1,10 @@ -/* * Builtin help command */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "exec-cmd.h"
builtin/index-pack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "delta.h"
builtin/log.c +3 -0
@@ -4,7 +4,10 @@* (C) Copyright 2006 Linus Torvalds * 2006 Junio Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/ls-files.c +3 -0
@@ -5,7 +5,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "convert.h"
builtin/mailsplit.c +3 -0
@@ -4,6 +4,9 @@* It just splits a mbox into a list of files: "0001" "0002" .. * so you can process them further from there. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "string-list.h"
builtin/merge-file.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "diff.h"
builtin/merge-index.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "hex.h" #include "read-cache-ll.h"
builtin/merge-ours.c +3 -0
@@ -7,7 +7,10 @@* * Pretend we resolved the heads, but declare our tree trumps everybody else. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "builtin.h" #include "diff.h"
builtin/merge-tree.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "tree-walk.h" #include "xdiff-interface.h"
builtin/merge.c +3 -0
@@ -5,7 +5,10 @@* * Based on git-merge.sh by Junio C Hamano. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/mv.c +2 -0
@@ -3,7 +3,9 @@* * Copyright (C) 2006 Johannes Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h"
builtin/name-rev.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "environment.h" #include "gettext.h"
builtin/pack-objects.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "environment.h" #include "gettext.h"
builtin/pack-redundant.c +2 -0
@@ -5,7 +5,9 @@* This file is licensed under the GPL v2. * */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h"
builtin/pack-refs.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/patch-id.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/prune.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "commit.h" #include "diff.h"
builtin/pull.c +2 -0
@@ -7,6 +7,8 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/push.c +3 -0
@@ -1,7 +1,10 @@/* * "git push" */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "branch.h"
builtin/range-diff.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "object-name.h"
builtin/rebase.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (c) 2018 Pratik Karki */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/receive-pack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/reflog.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/remote.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/repack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "dir.h"
builtin/replay.c +3 -1
@@ -2,9 +2,11 @@* "git replay" builtin command */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" -#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "environment.h" #include "hex.h"
builtin/rerere.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/reset.c +3 -0
@@ -7,7 +7,10 @@* * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/rev-list.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "commit.h"
builtin/rev-parse.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/revert.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "builtin.h" #include "parse-options.h"
builtin/rm.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds 2006 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/shortlog.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "commit.h"
builtin/show-branch.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "environment.h"
builtin/show-index.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "hash.h"
builtin/sparse-checkout.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "dir.h"
builtin/stash.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/submodule--helper.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "environment.h"
builtin/tag.c +3 -0
@@ -5,7 +5,10 @@* Carlos Rica <[email protected]> * Based on git-tag.sh and mktag.c by Linus Torvalds. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/unpack-objects.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "bulk-checkin.h" #include "config.h"
builtin/update-index.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "bulk-checkin.h" #include "config.h"
builtin/update-ref.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/var.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Eric Biederman, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "attr.h"
builtin/worktree.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "advice.h"
bulk-checkin.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bulk-checkin.h"
bundle-uri.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bundle-uri.h"
bundle.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "lockfile.h"
cache-tree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
chunk-format.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "chunk-format.h"
color.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "color.h"
column.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "column.h"
combine-diff.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h"
commit-graph.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
commit-reach.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
commit.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h"
compat/fsmonitor/fsm-listen-darwin.c +2 -0
@@ -23,6 +23,8 @@#endif #endif +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "fsmonitor-ll.h" #include "fsm-listen.h"
compat/mingw.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "win32.h"
compat/poll/poll.c +2 -0
@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +/* To bump the minimum Windows version to Windows Vista */ #include "git-compat-util.h"
compat/terminal.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "compat/terminal.h" #include "gettext.h"
compat/win32mmap.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "../git-compat-util.h" void *git_mmap (void *start,size_t length,int prot,int flags,int fd,off_t offset)
compat/winansi.c +2 -0
@@ -4,6 +4,8 @@#undef NOGDI +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "../git-compat-util.h" #include <wingdi.h> #include <winreg.h>
config.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
connect.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
convert.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
credential.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
csum-file.c +1 -0
@@ -9,6 +9,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "progress.h"
daemon.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
date.c +2 -0
@@ -4,6 +4,8 @@* Copyright (C) Linus Torvalds, 2005 */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "date.h" #include "gettext.h"
decorate.c +3 -0
@@ -2,6 +2,9 @@* decorate.c - decorate a git object with some arbitrary * data. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "object.h" #include "decorate.h"
delta-islands.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object.h"
diagnose.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diagnose.h"
diff-delta.c +2 -0
@@ -11,6 +11,8 @@* published by the Free Software Foundation. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "delta.h"
diff-lib.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
diff-merges.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diff-merges.h"
diff-no-index.c +2 -0
@@ -4,6 +4,8 @@* Copyright (c) 2008 by Junio C Hamano */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "abspath.h" #include "color.h"
diff.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
diffcore-order.c +3 -0
@@ -1,6 +1,9 @@/* * Copyright (C) 2005 Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
diffcore-pickaxe.c +3 -0
@@ -2,6 +2,9 @@* Copyright (C) 2005 Junio C Hamano * Copyright (C) 2010 Google Inc. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diff.h" #include "diffcore.h"
diffcore-rename.c +1 -0
@@ -4,6 +4,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h"
diffcore-rotate.c +3 -0
@@ -2,6 +2,9 @@* Copyright (C) 2021, Google LLC. * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
dir.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
entry.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h"
ewah/ewah_bitmap.c +3 -0
@@ -16,6 +16,9 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h"
ewah/ewah_io.c +3 -0
@@ -16,6 +16,9 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "ewok.h" #include "strbuf.h"
ewah/ewah_rlw.c +3 -0
@@ -16,6 +16,9 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h"
fetch-pack.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
fmt-merge-msg.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
fsmonitor.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
gettext.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2010 Ævar Arnfjörð Bjarmason */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "abspath.h" #include "environment.h"
git.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
gpg-interface.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
graph.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
grep.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "gettext.h"
help.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
hex.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hash.h"
http-backend.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
http-push.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
http-walker.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
http.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "git-curl-compat.h"
imap-send.c +1 -0
@@ -22,6 +22,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
json-writer.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "json-writer.h"
kwset.c +2 -0
@@ -32,6 +32,8 @@String Matching: An Aid to Bibliographic Search," CACM June 1975, Vol. 18, No. 6, which describes the failure function used below. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "kwset.h"
line-log.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diffcore.h" #include "line-range.h"
list-objects-filter-options.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
list-objects-filter.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
list-objects.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h"
log-tree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit-reach.h"
ls-refs.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
mailinfo.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
mailmap.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
match-trees.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hex.h"
mem-pool.c +2 -0
@@ -2,6 +2,8 @@* Memory Pool implementation logic. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "mem-pool.h" #include "gettext.h"
merge-ll.c +1 -0
@@ -5,6 +5,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
merge-ort.c +1 -0
@@ -15,6 +15,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "merge-ort.h"
merge-recursive.c +1 -0
@@ -5,6 +5,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "merge-recursive.h"
merge.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
midx-write.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
midx.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
name-hash.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
notes-merge.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
notes.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
object-file-convert.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
object-file.c +1 -0
@@ -8,6 +8,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
object-name.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-name.h"
object.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
pack-bitmap-write.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
pack-bitmap.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
pack-check.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
packfile.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
parallel-checkout.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
patch-ids.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diff.h" #include "commit.h"
path.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
pathspec.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
pkt-line.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "copy.h" #include "pkt-line.h"
preload-index.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pathspec.h"
pretty.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
progress.c +1 -0
@@ -10,6 +10,7 @@#define GIT_TEST_PROGRESS_ONLY #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pager.h"
pseudo-merge.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pseudo-merge.h"
quote.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "path.h" #include "quote.h"
range-diff.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
reachable.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
read-cache.c +1 -0
@@ -5,6 +5,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bulk-checkin.h"
ref-filter.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
reflog-walk.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
reflog.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
refs.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
refs/debug.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "hex.h" #include "refs-internal.h"
refs/files-backend.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "../config.h"
refs/iterator.c +2 -0
@@ -3,6 +3,8 @@* documentation about the design and use of reference iterators. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "refs.h" #include "refs/refs-internal.h"
refs/packed-backend.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "../config.h"
refspec.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
reftable/system.h +2 -0
@@ -11,6 +11,8 @@ license that can be found in the LICENSE file or at/* This header glues the reftable library to the rest of Git */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "lockfile.h" #include "tempfile.h"
remote-curl.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "git-curl-compat.h"
remote.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
rerere.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
resolve-undo.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
revision.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
run-command.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "run-command.h"
scalar.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
send-pack.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
sequencer.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
serve.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
server-info.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
setup.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
shallow.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hex.h"
sideband.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "color.h"
sparse-index.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
split-index.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
strbuf.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "hex-ll.h"
string-list.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "string-list.h"
strvec.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "strvec.h" #include "strbuf.h"
submodule-config.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
submodule.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
symlinks.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "setup.h"
t/helper/test-bloom.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "bloom.h"
t/helper/test-cache-tree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "gettext.h"
t/helper/test-config.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "config.h"
t/helper/test-csprng.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-drop-caches.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-dump-fsmonitor.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "read-cache-ll.h"
t/helper/test-dump-split-index.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h"
t/helper/test-dump-untracked-cache.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "dir.h"
t/helper/test-genrandom.c +2 -0
@@ -4,6 +4,8 @@* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-genzeros.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-hash-speed.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "hash.h"
t/helper/test-mergesort.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "mem-pool.h" #include "mergesort.h"
t/helper/test-parse-options.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "parse-options.h" #include "strbuf.h"
t/helper/test-path-utils.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "abspath.h"
t/helper/test-reach.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
t/helper/test-ref-store.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h"
t/helper/test-revision-walking.c +1 -0
@@ -9,6 +9,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
t/helper/test-run-command.c +2 -0
@@ -8,6 +8,8 @@* published by the Free Software Foundation. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "run-command.h" #include "strvec.h"
t/helper/test-string-list.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "strbuf.h" #include "string-list.h"
t/helper/test-tool.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "test-tool.h" #include "test-tool-utils.h"
t/helper/test-trace2.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "strvec.h"
t/unit-tests/lib-reftable.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "lib-reftable.h" #include "test-lib.h" #include "reftable/constants.h"
t/unit-tests/t-example-decorate.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-lib.h" #include "object.h"
t/unit-tests/t-prio-queue.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "prio-queue.h"
t/unit-tests/t-reftable-readwrite.c +2 -0
@@ -6,6 +6,8 @@ license that can be found in the LICENSE file or athttps://developers.google.com/open-source/licenses/bsd */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "lib-reftable.h" #include "reftable/basics.h"
t/unit-tests/t-reftable-stack.c +2 -0
@@ -6,6 +6,8 @@ license that can be found in the LICENSE file or athttps://developers.google.com/open-source/licenses/bsd */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "lib-reftable.h" #include "reftable/merged.h"
t/unit-tests/t-trailer.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "trailer.h"
t/unit-tests/test-lib.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" enum result {
tag.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
tmp-objdir.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tmp-objdir.h"
trace.c +1 -0
@@ -22,6 +22,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
trace2.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "repository.h"
trace2/tr2_sysenv.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "dir.h"
trace2/tr2_tgt_event.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "json-writer.h"
trace2/tr2_tgt_perf.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "repository.h"
trailer.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
transport-helper.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "transport.h"
transport.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
tree-diff.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h"
unix-socket.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "strbuf.h" #include "unix-socket.h"
unpack-trees.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
upload-pack.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
urlmatch.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "hex-ll.h"
usage.c +3 -0
@@ -3,6 +3,9 @@* * Copyright (C) Linus Torvalds, 2005 */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "trace2.h"
userdiff.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
utf8.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "strbuf.h" #include "utf8.h"
version.c +1 -0
@@ -1,3 +1,4 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "version.h" #include "strbuf.h"
versioncmp.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
worktree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
wrapper.c +3 -0
@@ -1,6 +1,9 @@/* * Various trivial helper wrappers around standard functions */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "abspath.h" #include "parse.h"
ws.c +3 -0
@@ -3,6 +3,9 @@* * Copyright (c) 2007 Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "attr.h" #include "strbuf.h"
wt-status.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
xdiff-interface.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
xdiff/xdiffi.c +1 -0
@@ -19,6 +19,7 @@* Davide Libenzi <[email protected]> * */ +#define DISABLE_SIGN_COMPARE_WARNINGS #include "xinclude.h"
xdiff/xinclude.h +2 -0
@@ -23,6 +23,8 @@#if !defined(XINCLUDE_H )#define XINCLUDE_H +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "xmacros.h" #include "xdiff.h"
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 5/15 config.mak.dev: drop `-Wno-sign-compare`
In reply to Patrick SteinhardtThere is no need anymore to disable -Wsign-compare now that all files that cause warnings have been marked accordingly. Drop the option.
--- config.mak.dev | 1 - 1 file changed, 1 deletion(-)
config.mak.dev +0 -1
@@ -53,7 +53,6 @@ ifeq ($(filter extra-all,$(DEVOPTS)),) # These are disabled because we have these all over the place. DEVELOPER_CFLAGS += -Wno-empty-body DEVELOPER_CFLAGS += -Wno-missing-field-initializers -DEVELOPER_CFLAGS += -Wno-sign-compare endif endif
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 6/15 diff.h: fix index used to loop through unsigned integer
In reply to Patrick SteinhardtThe struct diff_flags structure is essentially an array of flags, all of which have the same type. We can thus use sizeof() to iterate through all of the flags, which we do in diff_flags_or(). But while the statement returns an unsigned integer, we used a signed integer to iterate through the flags, which generates a warning.
Fix this by using size_t for the index instead.
--- builtin/am.c | 1 - builtin/diff-tree.c | 1 - builtin/merge-ours.c | 1 - builtin/pack-refs.c | 1 - builtin/range-diff.c | 1 - builtin/reflog.c | 1 - builtin/reset.c | 1 - builtin/revert.c | 1 - builtin/shortlog.c | 1 - diff-merges.c | 2 -- diff.h | 3 +-- diffcore-order.c | 2 -- diffcore-rotate.c | 2 -- list-objects-filter.c | 1 - patch-ids.c | 2 -- reachable.c | 1 - reflog-walk.c | 1 - t/helper/test-revision-walking.c | 1 - 18 files changed, 1 insertion(+), 23 deletions(-)
builtin/am.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h"
builtin/diff-tree.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/merge-ours.c +0 -1
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "builtin.h"
builtin/pack-refs.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/range-diff.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h"
builtin/reflog.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/reset.c +0 -1
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h"
builtin/revert.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "builtin.h"
builtin/shortlog.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
diff-merges.c +0 -2
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "diff-merges.h"
diff.h +1 -2
@@ -205,9 +205,8 @@ static inline void diff_flags_or(struct diff_flags *a, {char *tmp_a = (char *)a;const char *tmp_b = (const char *)b; -int i; -for (i =0 ; i <sizeof (struct diff_flags ); i++) +for (size_t i =0 ; i <sizeof (struct diff_flags ); i++) tmp_a[i] |= tmp_b[i]; }
diffcore-order.c +0 -2
@@ -2,8 +2,6 @@* Copyright (C) 2005 Junio C Hamano */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
diffcore-rotate.c +0 -2
@@ -3,8 +3,6 @@* Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
list-objects-filter.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
patch-ids.c +0 -2
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "diff.h" #include "commit.h"
reachable.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
reflog-walk.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
t/helper/test-revision-walking.c +0 -1
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 7/15 sign-compare: 32-bit support
In reply to Patrick SteinhardtFrom: Junio C Hamano <[email protected]>
On 32-bit platforms, ssize_t may be "int" while size_t may be "unsigned int". At times we compare the number of bytes we read stored in a ssize_t variable with "unsigned int", but that is done after we check that we did not get an error return (which is negative---and that is the whole reason why we used ssize_t and not size_t), so these comparisons are safe.
But compilers may not realize that. Cast these to size_t to work around the false positives. On platforms with size_t/ssize_t wider than a normal int, this won't be an issue.
--- csum-file.c | 3 +-- pkt-line.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
csum-file.c +1 -2
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "progress.h"
@@ -24,7 +23,7 @@ static void verify_buffer_or_die(struct hashfile *f,if (ret <0 )die_errno ("%s: sha1 file read error" , f->name); -if (ret != count) +if ((size_t )ret != (size_t )count)die ("%s: sha1 file truncated" , f->name);if (memcmp (buf, f->check_buffer, count))die ("sha1 file '%s' validation error" , f->name);
pkt-line.c +1 -1
@@ -363,7 +363,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, }/* And complain if we didn't get enough bytes to satisfy the read. */ -if (ret != size) { +if ((size_t )ret != (size_t )size) {if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
Re: [PATCH v3 07/15] sign-compare: 32-bit support
csum-file.c static void verify_buffer_or_die(struct hashfile *f, · line 27
Quoted 7 lines · Patrick Steinhardt
csum-file.c +1
-1@@ -24,7 +23,7 @@ static void verify_buffer_or_die(struct hashfile *f,if (ret <0 )die_errno ("%s: sha1 file read error" , f->name); -if (ret != count) +if ((size_t )ret != (size_t )count)die ("%s: sha1 file truncated" , f->name);
You really only need the cast on the left-hand side here. "count" is already an unsigned value (and will get promoted as necessary on a system where "unsigned int" is smaller than "size_t").
It's probably not hurting too much, but my philosophy is that we should do as few casts as strictly necessary. Casts are a blunt instrument for telling the compiler we know what we are doing, and can cover up issues (in this case a false positive, but imagine "count" was switched to "int").
IMHO "count" should probably be a size_t here anyway, since we are dealing with a buffer size. If you look at the call stack, it is based on hashfile.buffer, which we'd expect to be small. But it is initialized from a size_t, so really it is one errant hashfd_internal() from being a truncation bug. That's not a mistake I expect to be likely, but I think we are better off in general making code as obviously/trivially correct as possible.
I think truncation is getting out of scope for your series, though, so probably not worth doing right at this moment.
pkt-line.c static int get_packet_data(int fd, char **src_buf, size_t *src_size, · line 368
Quoted 12 lines
pkt-line.c +1
-1@@ -363,7 +363,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, }/* And complain if we didn't get enough bytes to satisfy the read. */ -if (ret != size) { +if ((size_t )ret != (size_t )size) {if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ;
Likewise here, "size" is already unsigned.
I also wondered if there was a safer solution than a bare cast here. Both of these are OK because the lines immediately before them checked for the negative value, but there's nothing at the compiler level to enforce that.
I guess a solution that uses the type system would be akin to Option from Rust, et al. A helper that checks for negative values and also promotes to an unsigned type, like:
ssize_t ret = read_in_full(fd, buf, count); size_t bytes_read;
if (!signed_to_unsigned(ret, &bytes_read))
die_errno(...); /* error */
if (bytes_read != count)
...I don't know if there's a more ergonomic way that ditches the extra variable. Or if there are enough cases like this to merit having a helper.
-Peff
Re: [PATCH v3 07/15] sign-compare: 32-bit support
Quoted 14 lines · Jeff King
csum-file.c static void verify_buffer_or_die(struct hashfile *f, · line 27
Quoted 7 lines · Patrick Steinhardt
csum-file.c +1
-1@@ -24,7 +23,7 @@ static void verify_buffer_or_die(struct hashfile *f,if (ret <0 )die_errno ("%s: sha1 file read error" , f->name); -if (ret != count) +if ((size_t )ret != (size_t )count)die ("%s: sha1 file truncated" , f->name);You really only need the cast on the left-hand side here. "count" is already an unsigned value (and will get promoted as necessary on a system where "unsigned int" is smaller than "
size_t").
Quoted 5 lines
It's probably not hurting too much, but my philosophy is that we should do as few casts as strictly necessary. Casts are a blunt instrument for telling the compiler we know what we are doing, and can cover up issues (in this case a false positive, but imagine "count" was switched to "int").
Fair, will adapt.
Quoted 7 lines
IMHO "count" should probably be a
size_there anyway, since we are dealing with a buffer size. If you look at the call stack, it is based on hashfile.buffer, which we'd expect to be small. But it is initialized from asize_t, so really it is one erranthashfd_internal()from being a truncation bug. That's not a mistake I expect to be likely, but I think we are better off in general making code as obviously/trivially correct as possible.
Agreed, it's also something I've been pushing for when doing reviews.
Quoted 2 lines
I think truncation is getting out of scope for your series, though, so probably not worth doing right at this moment.
Agreed, as well.
Quoted 25 lines
pkt-line.c static int get_packet_data(int fd, char **src_buf, size_t *src_size, · line 368
Quoted 12 lines
pkt-line.c +1
-1@@ -363,7 +363,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, }/* And complain if we didn't get enough bytes to satisfy the read. */ -if (ret != size) { +if ((size_t )ret != (size_t )size) {if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ;Likewise here, "size" is already unsigned.
I also wondered if there was a safer solution than a bare cast here. Both of these are OK because the lines immediately before them checked for the negative value, but there's nothing at the compiler level to enforce that.
I guess a solution that uses the type system would be akin to Option from Rust, et al. A helper that checks for negative values and also promotes to an unsigned type, like:
Quoted 7 lines
ssize_t ret = read_in_full(fd, buf, count); size_t bytes_read;if (!signed_to_unsigned(ret,
&bytes_read))die_errno(...); /* error */ if (bytes_read != count) ...
The function is kind of curious anyway. It returns an int that has been assigned the ssize_t, which may overflow. Callers don't care for the number of bytes read in the first place though, so we can just adapt the function to return an error code, only. I'll do that.
Quoted 3 lines
I don't know if there's a more ergonomic way that ditches the extra variable. Or if there are enough cases like this to merit having a helper.
We already have cast_size_t_to_int(), cast_size_t_to_long() and cast_size_t_to_uint32_t(), all of which cause us to die in case the cast needs to truncate. I think we can easily extend this mechanism going forward.
Patrick
PATCH v3 8/15 global: trivial conversions to fix `-Wsign-compare` warnings
In reply to Patrick SteinhardtWe have a bunch of loops which iterate up to an unsigned boundary using a signed index, which generates warnigs because we compare a signed and unsigned value in the loop condition. Address these sites for trivial cases and enable -Wsign-compare warnings for these code units.
This patch only adapts those code units where we can drop the DISABLE_SIGN_COMPARE_WARNINGS macro in the same step.
--- advice.c | 9 ++------- base85.c | 5 +---- builtin/add.c | 10 ++++------ builtin/branch.c | 1 - builtin/difftool.c | 4 ++-- builtin/for-each-repo.c | 5 ++--- builtin/help.c | 4 +--- builtin/mailsplit.c | 3 +-- builtin/merge-tree.c | 6 ++---- builtin/pack-redundant.c | 4 +--- builtin/pull.c | 4 +--- builtin/push.c | 5 ++--- builtin/rerere.c | 9 ++++----- builtin/stash.c | 7 ++----- builtin/submodule--helper.c | 8 +++----- builtin/var.c | 4 +--- commit.c | 4 +--- compat/fsmonitor/fsm-listen-darwin.c | 5 +---- compat/terminal.c | 5 +---- diagnose.c | 8 +++----- diffcore-rename.c | 4 +--- entry.c | 5 ++--- ewah/ewah_bitmap.c | 6 +----- git.c | 21 +++++++-------------- help.h | 8 +++----- hex.c | 7 ++----- http-push.c | 4 +--- list-objects-filter-options.c | 5 +---- list-objects.c | 8 ++------ ls-refs.c | 5 +---- merge.c | 5 ++--- path.c | 5 ++--- pkt-line.c | 5 +---- refs/debug.c | 5 +---- send-pack.c | 6 ++---- serve.c | 8 ++------ strvec.c | 5 +---- t/helper/test-bloom.c | 10 ++-------- t/helper/test-dump-fsmonitor.c | 4 +--- t/helper/test-dump-split-index.c | 4 +--- t/helper/test-dump-untracked-cache.c | 7 +++---- t/helper/test-hash-speed.c | 7 ++----- t/helper/test-parse-options.c | 7 ++----- t/helper/test-reach.c | 4 +--- t/helper/test-ref-store.c | 4 +--- t/helper/test-tool.c | 5 +---- t/unit-tests/t-example-decorate.c | 5 ++--- t/unit-tests/t-prio-queue.c | 4 +--- tmp-objdir.c | 4 +--- trailer.c | 4 +--- transport-helper.c | 14 ++++++-------- transport.c | 14 ++++---------- usage.c | 4 +--- version.c | 4 +--- versioncmp.c | 4 +--- 55 files changed, 99 insertions(+), 232 deletions(-)
advice.c +2 -7
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "advice.h" #include "config.h"
@@ -162,7 +160,6 @@ void advise_if_enabled(enum advice_type type, const char *advice, ...)int git_default_advice_config (const char *var,const char *value) {const char *k, *slot_name; -int i;if (!strcmp (var,"color.advice" )) { advice_use_color =git_config_colorbool (var, value);
@@ -181,7 +178,7 @@ int git_default_advice_config(const char *var, const char *value)if (!skip_prefix (var,"advice." , &k))return 0 ; -for (i =0 ; i <ARRAY_SIZE (advice_setting); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (advice_setting); i++) {if (strcasecmp (k, advice_setting[i].key))continue ; advice_setting[i].level =git_config_bool (var, value)
@@ -195,9 +192,7 @@ int git_default_advice_config(const char *var, const char *value)void list_config_advices (struct string_list *list,const char *prefix) { -int i; - -for (i =0 ; i <ARRAY_SIZE (advice_setting); i++) +for (size_t i =0 ; i <ARRAY_SIZE (advice_setting); i++)list_config_item (list, prefix, advice_setting[i].key); }
base85.c +1 -4
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "base85.h"
@@ -31,10 +29,9 @@ static const char en85[] = {static char de85[256 ];static void prep_base85 (void ) { -int i;if (de85['Z' ])return ; -for (i =0 ; i <ARRAY_SIZE (en85); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (en85); i++) {int ch = en85[i]; de85[ch] = i +1 ; }
builtin/add.c +4 -6
@@ -4,8 +4,6 @@* Copyright (C) 2006 Linus Torvalds */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "builtin.h" #include "advice.h" #include "config.h"
@@ -42,9 +40,9 @@ static int chmod_pathspec(struct repository *repo,char flip, int show_only) { - int i, ret = 0; + int ret = 0; -for (i =0 ; i < repo->index->cache_nr; i++) { +for (size_t i =0 ; i < repo->index->cache_nr; i++) {struct cache_entry *ce = repo->index->cache[i];int err;
@@ -72,9 +70,9 @@ static int renormalize_tracked_files(struct repository *repo,const struct pathspec *pathspec, int flags) { - int i, retval = 0; + int retval = 0; -for (i =0 ; i < repo->index->cache_nr; i++) { +for (size_t i =0 ; i < repo->index->cache_nr; i++) {struct cache_entry *ce = repo->index->cache[i]; if (!include_sparse &&
builtin/branch.c +0 -1
@@ -6,7 +6,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/difftool.c +2 -2
@@ -13,7 +13,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h"
@@ -367,7 +366,8 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,char *lbase_dir =NULL , *rbase_dir =NULL ;size_t ldir_len, rdir_len, wtdir_len;const char *workdir, *tmp; -int ret =0 , i; +int ret =0 ; +size_t i;FILE *fp =NULL ;struct hashmap working_tree_dups =HASHMAP_INIT (working_tree_entry_cmp,NULL );
builtin/for-each-repo.c +2 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -38,7 +37,7 @@ int cmd_for_each_repo(int argc, {static const char *config_key =NULL ;int keep_going =0 ; -int i, result =0 ; +int result =0 ;const struct string_list *values;int err;
@@ -63,7 +62,7 @@ int cmd_for_each_repo(int argc,else if (err)return 0 ; -for (i =0 ; i < values->nr; i++) { +for (size_t i =0 ; i < values->nr; i++) {int ret =run_command_on_repo (values->items[i].string, argc, argv);if (ret) {if (!keep_going)
builtin/help.c +1 -3
@@ -3,7 +3,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -131,7 +130,6 @@ static void list_config_help(enum show_config_type type)struct string_list keys =STRING_LIST_INIT_DUP ;struct string_list keys_uniq =STRING_LIST_INIT_DUP ;struct string_list_item *item; -int i;for (p = config_name_list; *p; p++) {const char *var = *p;
@@ -158,7 +156,7 @@ static void list_config_help(enum show_config_type type) e->prefix, e->placeholder);string_list_sort (&keys); -for (i =0 ; i < keys.nr; i++) { +for (size_t i =0 ; i < keys.nr; i++) {const char *var = keys.items[i].string;const char *wildcard, *tag, *cut;const char *dot =NULL ;
builtin/mailsplit.c +1 -2
@@ -175,7 +175,6 @@ static int split_maildir(const char *maildir, const char *dir,char *file =NULL ;FILE *f =NULL ;int ret =-1 ; -int i;struct string_list list =STRING_LIST_INIT_DUP ; list.cmp = maildir_filename_cmp;
@@ -183,7 +182,7 @@ static int split_maildir(const char *maildir, const char *dir,if (populate_maildir_list (&list, maildir) <0 ) goto out; -for (i =0 ; i < list.nr; i++) { +for (size_t i =0 ; i < list.nr; i++) {char *name;free (file);
builtin/merge-tree.c +2 -4
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "tree-walk.h"
@@ -499,10 +498,9 @@ static int real_merge(struct merge_tree_options *o,if (!result.clean) {struct string_list conflicted_files =STRING_LIST_INIT_NODUP ;const char *last =NULL ; -int i;merge_get_conflicted_files (&result, &conflicted_files); -for (i =0 ; i < conflicted_files.nr; i++) { +for (size_t i =0 ; i < conflicted_files.nr; i++) {const char *name = conflicted_files.items[i].string;struct stage_info *c = conflicted_files.items[i].util;if (!o->name_only)
@@ -586,7 +584,7 @@ int cmd_merge_tree(int argc,if (xopts.nr && o.mode ==MODE_TRIVIAL )die (_ ("--trivial-merge is incompatible with all other options" )); -for (int x =0 ; x < xopts.nr; x++) +for (size_t x =0 ; x < xopts.nr; x++)if (parse_merge_opt (&o.merge_options, xopts.v[x]))die (_ ("unknown strategy option: -X%s" ), xopts.v[x]);
builtin/pack-redundant.c +1 -3
@@ -7,7 +7,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h"
@@ -391,7 +390,6 @@ static int cmp_remaining_objects(const void *a, const void *b)static void sort_pack_list (struct pack_list **pl) {struct pack_list **ary, *p; -int i;size_t n =pack_list_size (*pl);if (n <2 )
@@ -405,7 +403,7 @@ static void sort_pack_list(struct pack_list **pl)QSORT (ary, n, cmp_remaining_objects);/* link them back again */ -for (i =0 ; i < n -1 ; i++) +for (size_t i =0 ; i < n -1 ; i++) ary[i]->next = ary[i +1 ]; ary[n -1 ]->next =NULL ; *pl = ary[0 ];
builtin/pull.c +1 -3
@@ -7,7 +7,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h"
@@ -943,11 +942,10 @@ static int get_can_ff(struct object_id *orig_head,static int already_up_to_date (struct object_id *orig_head,struct oid_array *merge_heads) { -int i;struct commit *ours; ours =lookup_commit_reference (the_repository, orig_head); -for (i =0 ; i < merge_heads->nr; i++) { +for (size_t i =0 ; i < merge_heads->nr; i++) {struct commit_list *list =NULL ;struct commit *theirs;int ok;
builtin/push.c +2 -3
@@ -3,7 +3,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h"
@@ -420,7 +419,7 @@ static int do_push(int flags,const struct string_list *push_options, struct remote *remote) { - int i, errs; + int errs;struct strvec *url;struct refspec *push_refspec = &rs;
@@ -435,7 +434,7 @@ static int do_push(int flags, } errs =0 ; url =push_url_of_remote (remote); -for (i =0 ; i < url->nr; i++) { +for (size_t i =0 ; i < url->nr; i++) {struct transport *transport =transport_get (remote, url->v[i]);if (flags &TRANSPORT_PUSH_OPTIONS )
builtin/rerere.c +4 -5
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -57,7 +56,7 @@ int cmd_rerere(int argc, struct repository *repo UNUSED) { struct string_list merge_rr = STRING_LIST_INIT_DUP; - int i, autoupdate = -1, flags = 0; + int autoupdate = -1, flags = 0; struct option options[] = { OPT_SET_INT(0, "rerere-autoupdate", &autoupdate,
@@ -100,11 +99,11 @@ int cmd_rerere(int argc,if (setup_rerere (the_repository, &merge_rr, flags |RERERE_READONLY ) <0 )return 0 ; -for (i =0 ; i < merge_rr.nr; i++) +for (size_t i =0 ; i < merge_rr.nr; i++)printf ("%s\n" , merge_rr.items[i].string); }else if (!strcmp (argv[0 ],"remaining" )) {rerere_remaining (the_repository, &merge_rr); -for (i =0 ; i < merge_rr.nr; i++) { +for (size_t i =0 ; i < merge_rr.nr; i++) {if (merge_rr.items[i].util !=RERERE_RESOLVED )printf ("%s\n" , merge_rr.items[i].string);else
@@ -116,7 +115,7 @@ int cmd_rerere(int argc,if (setup_rerere (the_repository, &merge_rr, flags |RERERE_READONLY ) <0 )return 0 ; -for (i =0 ; i < merge_rr.nr; i++) { +for (size_t i =0 ; i < merge_rr.nr; i++) {const char *path = merge_rr.items[i].string;const struct rerere_id *id = merge_rr.items[i].util;if (diff_two (rerere_path (id,"preimage" ), path, path, path))
builtin/stash.c +2 -5
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h"
@@ -869,9 +868,8 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_opstruct tree *tree[ARRAY_SIZE (oid)];struct tree_desc tree_desc[ARRAY_SIZE (oid)];struct unpack_trees_options unpack_tree_opt = {0 }; -int i; -for (i =0 ; i <ARRAY_SIZE (oid); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (oid); i++) { tree[i] =parse_tree_indirect (oid[i]);if (parse_tree (tree[i]) <0 )die (_ ("failed to parse tree" ));
@@ -1550,12 +1548,11 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int qrepo_read_index_preload (the_repository,NULL ,0 );if (!include_untracked && ps->nr) { -int i;char *ps_matched =xcalloc (ps->nr,1 );/* TODO: audit for interaction with sparse-index. */ ensure_full_index (the_repository->index); -for (i =0 ; i < the_repository->index->cache_nr; i++) +for (size_t i =0 ; i < the_repository->index->cache_nr; i++)ce_path_match (the_repository->index, the_repository->index->cache[i], ps, ps_matched);
builtin/submodule--helper.c +3 -5
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h"
@@ -196,7 +195,7 @@ static int module_list_compute(const char **argv,struct pathspec *pathspec, struct module_list *list) { - int i, result = 0; + int result = 0;char *ps_matched =NULL ; parse_pathspec(pathspec, 0,
@@ -209,7 +208,7 @@ static int module_list_compute(const char **argv,if (repo_read_index (the_repository) <0 )die (_ ("index file corrupt" )); - for (i = 0; i < the_repository->index->cache_nr; i++) { + for (size_t i = 0; i < the_repository->index->cache_nr; i++) { const struct cache_entry *ce = the_repository->index->cache[i]; if (!match_pathspec(the_repository->index, pathspec, ce->name, ce_namelen(ce),
@@ -3385,7 +3384,6 @@ static void die_on_index_match(const char *path, int force)die (_ ("index file corrupt" ));if (ps.nr) { -int i;char *ps_matched =xcalloc (ps.nr,1 );/* TODO: audit for interaction with sparse-index. */
@@ -3395,7 +3393,7 @@ static void die_on_index_match(const char *path, int force)* Since there is only one pathspec, we just need to * check ps_matched[0] to know if a cache entry matched. */ -for (i =0 ; i < the_repository->index->cache_nr; i++) { +for (size_t i =0 ; i < the_repository->index->cache_nr; i++) {ce_path_match (the_repository->index, the_repository->index->cache[i], &ps, ps_matched);
builtin/var.c +1 -3
@@ -5,7 +5,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h"
@@ -181,10 +180,9 @@ static void list_vars(void)if ((val = ptr->read (0 ))) {if (ptr->multivalued && *val) {struct string_list list =STRING_LIST_INIT_DUP ; -int i;string_list_split (&list, val,'\n' ,-1 ); -for (i =0 ; i < list.nr; i++) +for (size_t i =0 ; i < list.nr; i++)printf ("%s=%s\n" , ptr->name, list.items[i].string);string_list_clear (&list,0 ); }else {
commit.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h"
@@ -1766,7 +1765,6 @@ int commit_tree_extended(const char *msg, size_t msg_len, { &compat_sig, r->compat_hash_algo }, { &sig, r->hash_algo }, }; -int i;/* * We write algorithms in the order they were implemented in
@@ -1780,7 +1778,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,* We traverse each algorithm in order, and apply the signature * to each buffer. */ -for (i =0 ; i <ARRAY_SIZE (bufs); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (bufs); i++) {if (!bufs[i].algo)continue ;add_header_signature (&buffer, bufs[i].sig, bufs[i].algo);
compat/fsmonitor/fsm-listen-darwin.c +1 -4
@@ -23,8 +23,6 @@#endif #endif -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "fsmonitor-ll.h" #include "fsm-listen.h"
@@ -210,13 +208,12 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef UNUSED,const char *slash;char *resolved =NULL ;struct strbuf tmp =STRBUF_INIT ; -int k;/* * Build a list of all filesystem changes into a private/local * list and without holding any locks. */ -for (k =0 ; k < num_of_events; k++) { +for (size_t k =0 ; k < num_of_events; k++) {/* * On Mac, we receive an array of absolute paths. */
compat/terminal.c +1 -4
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "compat/terminal.h" #include "gettext.h"
@@ -261,14 +259,13 @@ static DWORD cmode_in, cmode_out;void restore_term (void ) {if (use_stty) { -int i;struct child_process cp =CHILD_PROCESS_INIT ;if (stty_restore.nr ==0 )return ;strvec_push (&cp.args,"stty" ); -for (i =0 ; i < stty_restore.nr; i++) +for (size_t i =0 ; i < stty_restore.nr; i++)strvec_push (&cp.args, stty_restore.items[i].string);run_command (&cp);string_list_clear (&stty_restore,0 );
diagnose.c +3 -5
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diagnose.h"
@@ -32,7 +31,6 @@ static struct diagnose_option diagnose_options[] = {int option_parse_diagnose (const struct option *opt,const char *arg,int unset) { -int i;enum diagnose_mode *diagnose = opt->value;if (!arg) {
@@ -40,7 +38,7 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)return 0 ; } -for (i =0 ; i <ARRAY_SIZE (diagnose_options); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (diagnose_options); i++) {if (!strcmp (arg, diagnose_options[i].option_name)) { *diagnose = diagnose_options[i].mode;return 0 ;
@@ -187,7 +185,7 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode)char **argv_copy =NULL ;int stdout_fd =-1 , archiver_fd =-1 ;struct strbuf buf =STRBUF_INIT ; -int res, i; +int res;struct archive_dir archive_dirs[] = { {".git" ,0 }, {".git/hooks" ,0 },
@@ -240,7 +238,7 @@ int create_diagnostics_archive(struct strbuf *zip_path, enum diagnose_mode mode)/* Only include this if explicitly requested */ if (mode ==DIAGNOSE_ALL ) { -for (i =0 ; i <ARRAY_SIZE (archive_dirs); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (archive_dirs); i++) {if (add_directory_to_archiver (&archiver_args, archive_dirs[i].path, archive_dirs[i].recursive)) {
diffcore-rename.c +1 -3
@@ -4,7 +4,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h"
@@ -689,7 +688,6 @@ static void cleanup_dir_rename_info(struct dir_rename_info *info,struct hashmap_iter iter;struct strmap_entry *entry;struct string_list to_remove =STRING_LIST_INIT_NODUP ; -int i;if (!info->setup)return ;
@@ -735,7 +733,7 @@ static void cleanup_dir_rename_info(struct dir_rename_info *info,if (strintmap_contains (counts,UNKNOWN_DIR ))strintmap_remove (counts,UNKNOWN_DIR ); } -for (i =0 ; i < to_remove.nr; ++i) +for (size_t i =0 ; i < to_remove.nr; ++i)strmap_remove (info->dir_rename_count, to_remove.items[i].string,1 );string_list_clear (&to_remove,0 );
entry.c +2 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h"
@@ -442,7 +441,7 @@ static int check_path(const char *path, int len, struct stat *st, int skiplen)static void mark_colliding_entries (const struct checkout *state,struct cache_entry *ce,struct stat *st) { -int i, trust_ino = check_stat; +int trust_ino = check_stat;#if defined(GIT_WINDOWS_NATIVE ) || defined(__CYGWIN__) trust_ino =0 ;
@@ -452,7 +451,7 @@ static void mark_colliding_entries(const struct checkout *state,/* TODO: audit for interaction with sparse-index. */ ensure_full_index (state->istate); -for (i =0 ; i < state->istate->cache_nr; i++) { +for (size_t i =0 ; i < state->istate->cache_nr; i++) {struct cache_entry *dup = state->istate->cache[i];if (dup == ce) {
ewah/ewah_bitmap.c +1 -5
@@ -17,8 +17,6 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h"
@@ -258,10 +256,8 @@ void ewah_each_bit(struct ewah_bitmap *self, void (*callback)(size_t, void*), vo ++pointer;for (k =0 ; k <rlw_get_literal_words (word); ++k) { -int c; -/* todo: zero count optimization */ -for (c =0 ; c <BITS_IN_EWORD ; ++c, ++pos) { +for (size_t c =0 ; c <BITS_IN_EWORD ; ++c, ++pos) {if ((self->buffer[pointer] & ((eword_t )1 << c)) !=0 )callback (pos, payload); }
git.c +7 -14
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -56,7 +55,7 @@ static void list_builtins(struct string_list *list, unsigned int exclude_option)static void exclude_helpers_from_list (struct string_list *list) { -int i =0 ; +size_t i =0 ;while (i < list->nr) {if (strstr (list->items[i].string,"--" ))
@@ -76,7 +75,6 @@ static int match_token(const char *spec, int len, const char *token)static int list_cmds (const char *spec) {struct string_list list =STRING_LIST_INIT_DUP ; -int i;int nongit;/*
@@ -114,7 +112,7 @@ static int list_cmds(const char *spec)if (*spec ==',' ) spec++; } -for (i =0 ; i < list.nr; i++) +for (size_t i =0 ; i < list.nr; i++)puts (list.items[i].string);string_list_clear (&list,0 );return 0 ;
@@ -323,10 +321,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)trace2_cmd_name ("_query_" );if (!strcmp (cmd,"parseopt" )) {struct string_list list =STRING_LIST_INIT_DUP ; -int i;list_builtins (&list,NO_PARSEOPT ); -for (i =0 ; i < list.nr; i++) +for (size_t i =0 ; i < list.nr; i++)printf ("%s " , list.items[i].string);string_list_clear (&list,0 );exit (0 );
@@ -654,8 +651,7 @@ static struct cmd_struct commands[] = {static struct cmd_struct *get_builtin (const char *s) { -int i; -for (i =0 ; i <ARRAY_SIZE (commands); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (commands); i++) {struct cmd_struct *p = commands + i;if (!strcmp (s, p->cmd))return p;
@@ -670,8 +666,7 @@ int is_builtin(const char *s)static void list_builtins (struct string_list *out,unsigned int exclude_option) { -int i; -for (i =0 ; i <ARRAY_SIZE (commands); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (commands); i++) {if (exclude_option && (commands[i].option & exclude_option))continue ;
@@ -682,7 +677,6 @@ static void list_builtins(struct string_list *out, unsigned int exclude_option)void load_builtin_commands (const char *prefix,struct cmdnames *cmds) {const char *name; -int i;/* * Callers can ask for a subset of the commands based on a certain
@@ -693,7 +687,7 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds)if (!skip_prefix (prefix,"git-" , &prefix))BUG ("prefix '%s' must start with 'git-'" , prefix); -for (i =0 ; i <ARRAY_SIZE (commands); i++) +for (size_t i =0 ; i <ARRAY_SIZE (commands); i++)if (skip_prefix (commands[i].cmd, prefix, &name))add_cmdname (cmds, name,strlen (name)); }
@@ -859,9 +853,8 @@ static int run_argv(int *argcp, const char ***argv) seen =unsorted_string_list_lookup (&cmd_list, *argv[0 ]);if (seen) { -int i;struct strbuf sb =STRBUF_INIT ; -for (i =0 ; i < cmd_list.nr; i++) { +for (size_t i =0 ; i < cmd_list.nr; i++) {struct string_list_item *item = &cmd_list.items[i];strbuf_addf (&sb,"\n %s" , item->string);
help.h +3 -5
@@ -60,8 +60,7 @@ static inline void list_config_item(struct string_list *list,#define define_list_config_array (array) \ void list_config_##array(struct string_list *list, const char *prefix) \ { \ - int i; \ - for (i = 0; i < ARRAY_SIZE(array); i++) \ + for (size_t i = 0; i < ARRAY_SIZE(array); i++) \ if (array[i]) \ list_config_item(list, prefix, array[i]); \ } \
@@ -70,11 +69,10 @@ struct string_list#define define_list_config_array_extra (array, values) \ void list_config_##array(struct string_list *list, const char *prefix) \ { \ - int i; \ static const char *extra[] = values; \ - for (i = 0; i < ARRAY_SIZE(extra); i++) \ + for (size_t i = 0; i < ARRAY_SIZE(extra); i++) \ list_config_item(list, prefix, extra[i]); \ - for (i = 0; i < ARRAY_SIZE(array); i++) \ + for (size_t i = 0; i < ARRAY_SIZE(array); i++) \ if (array[i]) \ list_config_item(list, prefix, array[i]); \ } \
hex.c +2 -5
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hash.h"
@@ -8,8 +7,7 @@static int get_hash_hex_algop (const char *hex,unsigned char *hash,const struct git_hash_algo *algop) { -int i; -for (i =0 ; i < algop->rawsz; i++) { +for (size_t i =0 ; i < algop->rawsz; i++) {int val =hex2chr (hex);if (val <0 )return -1 ;
@@ -84,7 +82,6 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash, {static const char hex[] ="0123456789abcdef" ;char *buf = buffer; -int i;/* * Our struct object_id has been memset to 0, so default to printing
@@ -93,7 +90,7 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash,if (algop == &hash_algos[0 ]) algop = the_hash_algo; -for (i =0 ; i < algop->rawsz; i++) { +for (size_t i =0 ; i < algop->rawsz; i++) {unsigned int val = *hash++; *buf++ = hex[val >>4 ]; *buf++ = hex[val &0xf ];
http-push.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
@@ -1339,7 +1338,6 @@ static struct object_list **process_tree(struct tree *tree,static int get_delta (struct rev_info *revs,struct remote_lock *lock) { -int i;struct commit *commit;struct object_list **p = &objects;int count =0 ;
@@ -1352,7 +1350,7 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock) count +=add_send_request (&commit->object, lock); } -for (i =0 ; i < revs->pending.nr; i++) { +for (size_t i =0 ; i < revs->pending.nr; i++) {struct object_array_entry *entry = revs->pending.objects + i;struct object *obj = entry->item;const char *name = entry->name;
list-objects-filter-options.c +1 -4
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
@@ -395,8 +394,6 @@ void list_objects_filter_copy(struct list_objects_filter_options *dest, const struct list_objects_filter_options *src) { - int i; -/* Copy everything. We will overwrite the pointers shortly. */ memcpy(dest, src, sizeof(struct list_objects_filter_options));
@@ -405,7 +402,7 @@ void list_objects_filter_copy( dest->sparse_oid_name =xstrdup_or_null (src->sparse_oid_name);ALLOC_ARRAY (dest->sub, dest->sub_alloc); -for (i =0 ; i < src->sub_nr; i++) +for (size_t i =0 ; i < src->sub_nr; i++)list_objects_filter_copy (&dest->sub[i], &src->sub[i]); }
list-objects.c +2 -6
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h"
@@ -284,7 +283,6 @@ void mark_edges_uninteresting(struct rev_info *revs, int sparse) {struct commit_list *list; -int i;if (sparse) {struct oidset set;
@@ -321,7 +319,7 @@ void mark_edges_uninteresting(struct rev_info *revs, }if (revs->edge_hint_aggressive) { -for (i =0 ; i < revs->cmdline.nr; i++) { +for (size_t i =0 ; i < revs->cmdline.nr; i++) {struct object *obj = revs->cmdline.rev[i].item;struct commit *commit = (struct commit *)obj;if (obj->type !=OBJ_COMMIT || !(obj->flags &UNINTERESTING ))
@@ -344,11 +342,9 @@ static void add_pending_tree(struct rev_info *revs, struct tree *tree)static void traverse_non_commits (struct traversal_context *ctx,struct strbuf *base) { -int i; -assert (base->len ==0 ); -for (i =0 ; i < ctx->revs->pending.nr; i++) { +for (size_t i =0 ; i < ctx->revs->pending.nr; i++) {struct object_array_entry *pending = ctx->revs->pending.objects + i;struct object *obj = pending->item;const char *name = pending->name;
ls-refs.c +1 -4
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
@@ -54,12 +53,10 @@ static enum {*/ static int ref_match (const struct strvec *prefixes,const char *refname) { -int i; -if (!prefixes->nr)return 1 ;/* no restriction */ -for (i =0 ; i < prefixes->nr; i++) { +for (size_t i =0 ; i < prefixes->nr; i++) {const char *prefix = prefixes->v[i];if (starts_with (refname, prefix))
merge.c +2 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
@@ -26,11 +25,11 @@ int try_merge_command(struct repository *r, const char *head_arg, struct commit_list *remotes) { struct child_process cmd = CHILD_PROCESS_INIT; -int i, ret; +int ret;struct commit_list *j;strvec_pushf (&cmd.args,"merge-%s" , strategy); -for (i =0 ; i < xopts_nr; i++) +for (size_t i =0 ; i < xopts_nr; i++)strvec_pushf (&cmd.args,"--%s" , xopts[i]);for (j = common; j; j = j->next)strvec_push (&cmd.args,merge_argument (j->item));
path.c +2 -3
@@ -3,7 +3,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
@@ -1141,12 +1140,12 @@ int strbuf_normalize_path(struct strbuf *src)*/ int longest_ancestor_length (const char *path,struct string_list *prefixes) { -int i, max_len =-1 ; +int max_len =-1 ;if (!strcmp (path,"/" ))return -1 ; -for (i =0 ; i < prefixes->nr; i++) { +for (size_t i =0 ; i < prefixes->nr; i++) {const char *ceil = prefixes->items[i].string;int len =strlen (ceil);
pkt-line.c +1 -4
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "copy.h" #include "pkt-line.h"
@@ -41,7 +39,6 @@ static int packet_trace_pack(const char *buf, unsigned int len, int sideband)static void packet_trace (const char *buf,unsigned int len,int write) { -int i;struct strbuf out;static int in_pack, sideband;
@@ -74,7 +71,7 @@ static void packet_trace(const char *buf, unsigned int len, int write) get_trace_prefix(), write ? '>' : '<');/* XXX we should really handle printable utf8 */ -for (i =0 ; i < len; i++) { +for (unsigned int i =0 ; i < len; i++) {/* suppress newlines */ if (buf[i] =='\n' )continue ;
refs/debug.c +1 -4
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "hex.h" #include "refs-internal.h"
@@ -85,9 +83,8 @@ static void print_update(int i, const char *refname,static void print_transaction (struct ref_transaction *transaction) { -int i;trace_printf_key (&trace_refs,"transaction {\n" ); -for (i =0 ; i < transaction->nr; i++) { +for (size_t i =0 ; i < transaction->nr; i++) {struct ref_update *u = transaction->updates[i];print_update (i, u->refname, &u->old_oid, &u->new_oid, u->flags, u->type, u->msg);
send-pack.c +2 -4
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
@@ -73,7 +72,6 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,*/ struct child_process po =CHILD_PROCESS_INIT ;FILE *po_in; -int i;int rc;trace2_region_enter ("send_pack" ,"pack_objects" , the_repository);
@@ -105,9 +103,9 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised,* parameters by writing to the pipe. */ po_in =xfdopen (po.in,"w" ); -for (i =0 ; i < advertised->nr; i++) +for (size_t i =0 ; i < advertised->nr; i++)feed_object (&advertised->oid[i], po_in,1 ); -for (i =0 ; i < negotiated->nr; i++) +for (size_t i =0 ; i < negotiated->nr; i++)feed_object (&negotiated->oid[i], po_in,1 );while (refs) {
serve.c +2 -6
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
@@ -164,12 +163,11 @@ void protocol_v2_advertise_capabilities(void) {struct strbuf capability =STRBUF_INIT ;struct strbuf value =STRBUF_INIT ; -int i;/* serve by default supports v2 */ packet_write_fmt (1 ,"version 2\n" ); -for (i =0 ; i <ARRAY_SIZE (capabilities); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (capabilities); i++) {struct protocol_capability *c = &capabilities[i];if (c->advertise (the_repository, &value)) {
@@ -195,12 +193,10 @@ void protocol_v2_advertise_capabilities(void)static struct protocol_capability *get_capability (const char *key,const char **value) { -int i; -if (!key)return NULL ; -for (i =0 ; i <ARRAY_SIZE (capabilities); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (capabilities); i++) {struct protocol_capability *c = &capabilities[i];const char *out;if (!skip_prefix (key, c->name, &out))
strvec.c +1 -4
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "strvec.h" #include "strbuf.h"
@@ -110,8 +108,7 @@ void strvec_split(struct strvec *array, const char *to_split)void strvec_clear (struct strvec *array) {if (array->v != empty_strvec) { -int i; -for (i =0 ; i < array->nr; i++) +for (size_t i =0 ; i < array->nr; i++)free ((char *)array->v[i]);free (array->v); }
t/helper/test-bloom.c +2 -8
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "bloom.h"
@@ -12,30 +11,25 @@ static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;static void add_string_to_filter (const char *data,struct bloom_filter *filter) {struct bloom_key key; -int i;fill_bloom_key (data,strlen (data), &key, &settings);printf ("Hashes:" ); -for (i =0 ; i < settings.num_hashes; i++){ +for (size_t i =0 ; i < settings.num_hashes; i++)printf ("0x%08x|" , key.hashes[i]); - }printf ("\n" );add_key_to_filter (&key, filter, &settings);clear_bloom_key (&key); }static void print_bloom_filter (struct bloom_filter *filter) { -int i; -if (!filter) {printf ("No filter.\n" );return ; }printf ("Filter_Length:%d\n" , (int )filter->len);printf ("Filter_Data:" ); -for (i =0 ; i < filter->len; i++) { +for (size_t i =0 ; i < filter->len; i++)printf ("%02x|" , filter->data[i]); - }printf ("\n" ); }
t/helper/test-dump-fsmonitor.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "read-cache-ll.h"
@@ -9,7 +8,6 @@ int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED) {struct index_state *istate = the_repository->index; -int i;setup_git_directory ();if (do_read_index (istate, the_repository->index_file,0 ) <0 )
@@ -20,7 +18,7 @@ int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED) }printf ("fsmonitor last update %s\n" , istate->fsmonitor_last_update); -for (i =0 ; i < istate->cache_nr; i++) +for (size_t i =0 ; i < istate->cache_nr; i++)printf ((istate->cache[i]->ce_flags &CE_FSMONITOR_VALID ) ?"+" :"-" );return 0 ;
t/helper/test-dump-split-index.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h"
@@ -17,7 +16,6 @@ static void show_bit(size_t pos, void *data UNUSED) int cmd__dump_split_index(int ac UNUSED, const char **av) {struct split_index *si; -int i;setup_git_directory ();
@@ -29,7 +27,7 @@ int cmd__dump_split_index(int ac UNUSED, const char **av)return 0 ; }printf ("base %s\n" ,oid_to_hex (&si->base_oid)); -for (i =0 ; i < the_repository->index->cache_nr; i++) { +for (size_t i =0 ; i < the_repository->index->cache_nr; i++) {struct cache_entry *ce = the_repository->index->cache[i];printf ("%06o %s %d\t%s\n" , ce->ce_mode,oid_to_hex (&ce->oid),ce_stage (ce), ce->name);
t/helper/test-dump-untracked-cache.c +3 -4
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "dir.h"
@@ -24,7 +23,7 @@ static int compare_dir(const void *a_, const void *b_)static void dump (struct untracked_cache_dir *ucd,struct strbuf *base) { -int i, len; +int len;QSORT (ucd->untracked, ucd->untracked_nr, compare_untracked);QSORT (ucd->dirs, ucd->dirs_nr, compare_dir); len = base->len;
@@ -38,9 +37,9 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)if (ucd->valid)fputs (" valid" , stdout);printf ("\n" ); -for (i =0 ; i < ucd->untracked_nr; i++) +for (size_t i =0 ; i < ucd->untracked_nr; i++)printf ("%s\n" , ucd->untracked[i]); -for (i =0 ; i < ucd->dirs_nr; i++) +for (size_t i =0 ; i < ucd->dirs_nr; i++)dump (ucd->dirs[i], base);strbuf_setlen (base, len); }
t/helper/test-hash-speed.c +2 -5
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-tool.h" #include "hash.h"
@@ -18,12 +16,11 @@ int cmd__hash_speed(int ac, const char **av)unsigned char hash[GIT_MAX_RAWSZ ];clock_t initial, start, end;unsigned bufsizes[] = {64 ,256 ,1024 ,8192 ,16384 }; -int i;void *p;const struct git_hash_algo *algo =NULL ;if (ac ==2 ) { -for (i =1 ; i <GIT_HASH_NALGOS ; i++) { +for (size_t i =1 ; i <GIT_HASH_NALGOS ; i++) {if (!strcmp (av[1 ], hash_algos[i].name)) { algo = &hash_algos[i];break ;
@@ -38,7 +35,7 @@ int cmd__hash_speed(int ac, const char **av)printf ("algo: %s\n" , algo->name); -for (i =0 ; i <ARRAY_SIZE (bufsizes); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (bufsizes); i++) {unsigned long j, kb;double kb_per_sec; p =xcalloc (1 , bufsizes[i]);
t/helper/test-parse-options.c +2 -5
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-tool.h" #include "parse-options.h" #include "strbuf.h"
@@ -176,7 +174,6 @@ int cmd__parse_options(int argc, const char **argv)OPT_ALIAS ('Z' ,"alias-target" ,"alias-source" ), OPT_END(), }; -int i;int ret =0 ;trace2_cmd_name ("_parse_" );
@@ -200,10 +197,10 @@ int cmd__parse_options(int argc, const char **argv)show (&expect, &ret,"dry run: %s" , dry_run ?"yes" :"no" );show (&expect, &ret,"file: %s" , file ? file :"(not set)" ); -for (i =0 ; i < list.nr; i++) +for (size_t i =0 ; i < list.nr; i++)show (&expect, &ret,"list: %s" , list.items[i].string); -for (i =0 ; i < argc; i++) +for (int i =0 ; i < argc; i++)show (&expect, &ret,"arg %02d: %s" , i, argv[i]); expect.strdup_strings =1 ;
t/helper/test-reach.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
@@ -14,7 +13,6 @@static void print_sorted_commit_ids (struct commit_list *list) { -int i;struct string_list s =STRING_LIST_INIT_DUP ;while (list) {
@@ -24,7 +22,7 @@ static void print_sorted_commit_ids(struct commit_list *list)string_list_sort (&s); -for (i =0 ; i < s.nr; i++) +for (size_t i =0 ; i < s.nr; i++)printf ("%s\n" , s.items[i].string);string_list_clear (&s,0 );
t/helper/test-ref-store.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h"
@@ -25,14 +24,13 @@ struct flag_definition {static unsigned int parse_flags (const char *str,struct flag_definition *defs) {struct string_list masks =STRING_LIST_INIT_DUP ; -int i =0 ;unsigned int result =0 ;if (!strcmp (str,"0" ))return 0 ;string_list_split (&masks, str,',' ,64 ); -for (; i < masks.nr; i++) { +for (size_t i =0 ; i < masks.nr; i++) {const char *name = masks.items[i].string;struct flag_definition *def = defs;int found =0 ;
t/helper/test-tool.c +1 -4
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "test-tool.h" #include "test-tool-utils.h"
@@ -103,7 +101,6 @@ static NORETURN void die_usage(void) int cmd_main(int argc, const char **argv) { - int i; const char *working_directory = NULL; struct option options[] = { OPT_STRING('C', NULL, &working_directory, "directory",
@@ -122,7 +119,7 @@ int cmd_main(int argc, const char **argv)if (working_directory &&chdir (working_directory) <0 )die ("Could not cd to '%s'" , working_directory); -for (i =0 ; i <ARRAY_SIZE (cmds); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (cmds); i++) {if (!strcmp (cmds[i].name, argv[1 ])) { argv++; argc--;
t/unit-tests/t-example-decorate.c +2 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-lib.h" #include "object.h"
@@ -43,9 +42,9 @@ static void t_lookup(struct test_vars *vars)static void t_loop (struct test_vars *vars) { -int i, objects_noticed =0 ; +int objects_noticed =0 ; -for (i =0 ; i < vars->n.size; i++) { +for (size_t i =0 ; i < vars->n.size; i++) {if (vars->n.entries[i].base) objects_noticed++; }
t/unit-tests/t-prio-queue.c +1 -3
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-lib.h" #include "prio-queue.h"
@@ -27,7 +25,7 @@ static void test_prio_queue(int *input, size_t input_size,struct prio_queue pq = { intcmp };int j =0 ; -for (int i =0 ; i < input_size; i++) { +for (size_t i =0 ; i < input_size; i++) {void *peek, *get;switch (input[i]) {case GET :
tmp-objdir.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tmp-objdir.h"
@@ -238,7 +237,6 @@ static int migrate_paths(struct strbuf *src, struct strbuf *dst, {size_t src_len = src->len, dst_len = dst->len;struct string_list paths =STRING_LIST_INIT_DUP ; -int i;int ret =0 ;if (read_dir_paths (&paths, src->buf) <0 )
@@ -246,7 +244,7 @@ static int migrate_paths(struct strbuf *src, struct strbuf *dst, paths.cmp = pack_copy_cmp;string_list_sort (&paths); -for (i =0 ; i < paths.nr; i++) { +for (size_t i =0 ; i < paths.nr; i++) {const char *name = paths.items[i].string;enum finalize_object_file_flags flags_copy = flags;
trailer.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
@@ -523,7 +522,6 @@ static int git_trailer_config(const char *conf_key, const char *value,struct conf_info *conf;char *name =NULL ;enum trailer_info_type type; -int i;if (!skip_prefix (conf_key,"trailer." , &trailer_item))return 0 ;
@@ -533,7 +531,7 @@ static int git_trailer_config(const char *conf_key, const char *value,return 0 ; variable_name++; -for (i =0 ; i <ARRAY_SIZE (trailer_config_items); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (trailer_config_items); i++) {if (strcmp (trailer_config_items[i].name, variable_name))continue ; name =xstrndup (trailer_item, variable_name - trailer_item -1 );
transport-helper.c +6 -8
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "transport.h"
@@ -314,9 +313,9 @@ static int string_list_set_helper_option(struct helper_data *data, struct string_list *list) {struct strbuf buf =STRBUF_INIT ; -int i, ret =0 ; +int ret =0 ; -for (i =0 ; i < list->nr; i++) { +for (size_t i =0 ; i < list->nr; i++) {strbuf_addf (&buf,"option %s " , name);quote_c_style (list->items[i].string, &buf,NULL ,0 );strbuf_addch (&buf,'\n' );
@@ -334,7 +333,7 @@ static int set_helper_option(struct transport *transport, {struct helper_data *data = transport->data;struct strbuf buf =STRBUF_INIT ; -int i, ret, is_bool =0 ; +int ret, is_bool =0 ;get_helper (transport);
@@ -345,12 +344,12 @@ static int set_helper_option(struct transport *transport,return string_list_set_helper_option (data, name, (struct string_list *)value); -for (i =0 ; i <ARRAY_SIZE (unsupported_options); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (unsupported_options); i++) {if (!strcmp (name, unsupported_options[i]))return 1 ; } -for (i =0 ; i <ARRAY_SIZE (boolean_options); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (boolean_options); i++) {if (!strcmp (name, boolean_options[i])) { is_bool =1 ;break ;
@@ -482,7 +481,6 @@ static int get_exporter(struct transport *transport, {struct helper_data *data = transport->data;struct child_process *helper =get_helper (transport); -int i;child_process_init (fastexport);
@@ -498,7 +496,7 @@ static int get_exporter(struct transport *transport,if (data->import_marks)strvec_pushf (&fastexport->args,"--import-marks=%s" , data->import_marks); -for (i =0 ; i < revlist_args->nr; i++) +for (size_t i =0 ; i < revlist_args->nr; i++)strvec_push (&fastexport->args, revlist_args->items[i].string); fastexport->git_cmd =1 ;
transport.c +4 -10
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
@@ -48,7 +47,6 @@ static int transport_color_config(void)"color.transport.rejected" }, *key = "color.transport";char *value; -int i;static int initialized;if (initialized)
@@ -61,7 +59,7 @@ static int transport_color_config(void)if (!want_color_stderr (transport_use_color))return 0 ; -for (i =0 ; i <ARRAY_SIZE (keys); i++) +for (size_t i =0 ; i <ARRAY_SIZE (keys); i++)if (!git_config_get_string (keys[i], &value)) {if (!value)return config_error_nonbool (keys[i]);
@@ -154,14 +152,13 @@ static struct ref *get_refs_from_bundle(struct transport *transport, {struct bundle_transport_data *data = transport->data;struct ref *result =NULL ; -int i;if (for_push)return NULL ;get_refs_from_bundle_inner (transport); -for (i =0 ; i < data->header.references.nr; i++) { +for (size_t i =0 ; i < data->header.references.nr; i++) {struct string_list_item *e = data->header.references.items + i;const char *name = e->string;struct ref *ref =alloc_ref (name);
@@ -1282,11 +1279,9 @@ void transport_set_verbosity(struct transport *transport, int verbosity,static void die_with_unpushed_submodules (struct string_list *needs_pushing) { -int i; -fprintf (stderr,_ ("The following submodule paths contain changes that can\n" "not be found on any remote:\n" )); -for (i =0 ; i < needs_pushing->nr; i++) +for (size_t i =0 ; i < needs_pushing->nr; i++)fprintf (stderr," %s\n" , needs_pushing->items[i].string); fprintf(stderr, _("\nPlease try\n\n" " git push --recurse-submodules=on-demand\n\n"
@@ -1602,9 +1597,8 @@ int transport_get_remote_bundle_uri(struct transport *transport)void transport_unlock_pack (struct transport *transport,unsigned int flags) {int in_signal_handler = !!(flags &TRANSPORT_UNLOCK_PACK_IN_SIGNAL_HANDLER ); -int i; -for (i =0 ; i < transport->pack_lockfiles.nr; i++) +for (size_t i =0 ; i < transport->pack_lockfiles.nr; i++)if (in_signal_handler)unlink (transport->pack_lockfiles.items[i].string);else
usage.c +1 -3
@@ -4,8 +4,6 @@* Copyright (C) Linus Torvalds, 2005 */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "gettext.h" #include "trace2.h"
@@ -192,7 +190,7 @@ void NORETURN die(const char *err, ...)static const char *fmt_with_err (char *buf,int n,const char *fmt) {char str_error[256 ], *err; -int i, j; +size_t i, j; err =strerror (errno);for (i = j =0 ; err[i] && j <sizeof (str_error) -1 ; ) {
version.c +1 -3
@@ -1,4 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "version.h" #include "strbuf.h"
@@ -25,11 +24,10 @@ const char *git_user_agent_sanitized(void)if (!agent) {struct strbuf buf =STRBUF_INIT ; -int i;strbuf_addstr (&buf,git_user_agent ());strbuf_trim (&buf); -for (i =0 ; i < buf.len; i++) { +for (size_t i =0 ; i < buf.len; i++) {if (buf.buf[i] <=32 || buf.buf[i] >=127 ) buf.buf[i] ='.' ; }
versioncmp.c +1 -3
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
@@ -78,11 +77,10 @@ static int swap_prereleases(const char *s1,int off, int *diff) { - int i; struct suffix_match match1 = { -1, off, -1 };struct suffix_match match2 = {-1 , off,-1 }; -for (i =0 ; i < prereleases->nr; i++) { +for (size_t i =0 ; i < prereleases->nr; i++) {const char *suffix = prereleases->items[i].string;int start, suffix_len =strlen (suffix);if (suffix_len < off)
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 9/15 daemon: fix loops that have mismatching integer types
In reply to Patrick SteinhardtWe have several loops in "daemon.c" that use a signed integer to loop through a size_t. Adapt them to instead use a size_t as counter value.
--- daemon.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
daemon.c +8 -13
@@ -503,8 +503,7 @@ static struct daemon_service daemon_service[] = {static void enable_service (const char *name,int ena) { -int i; -for (i =0 ; i <ARRAY_SIZE (daemon_service); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (daemon_service); i++) {if (!strcmp (daemon_service[i].name, name)) { daemon_service[i].enabled = ena;return ;
@@ -515,8 +514,7 @@ static void enable_service(const char *name, int ena)static void make_service_overridable (const char *name,int ena) { -int i; -for (i =0 ; i <ARRAY_SIZE (daemon_service); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (daemon_service); i++) {if (!strcmp (daemon_service[i].name, name)) { daemon_service[i].overridable = ena;return ;
@@ -737,7 +735,7 @@ static void set_keep_alive(int sockfd)static int execute (void ) {char *line = packet_buffer; -int pktlen, len, i; +int pktlen, len;char *addr =getenv ("REMOTE_ADDR" ), *port =getenv ("REMOTE_PORT" );struct hostinfo hi =HOSTINFO_INIT ;struct strvec env =STRVEC_INIT ;
@@ -758,7 +756,7 @@ static int execute(void)if (len != pktlen)parse_extra_args (&hi, &env, line + len +1 , pktlen - len -1 ); -for (i =0 ; i <ARRAY_SIZE (daemon_service); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (daemon_service); i++) {struct daemon_service *s = &(daemon_service[i]);const char *arg;
@@ -1108,8 +1106,8 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct sif (!listen_addr->nr)setup_named_sock (NULL , listen_port, socklist);else { -int i, socknum; -for (i =0 ; i < listen_addr->nr; i++) { +int socknum; +for (size_t i =0 ; i < listen_addr->nr; i++) { socknum =setup_named_sock (listen_addr->items[i].string, listen_port, socklist);
@@ -1123,11 +1121,10 @@ static void socksetup(struct string_list *listen_addr, int listen_port, struct sstatic int service_loop (struct socketlist *socklist) {struct pollfd *pfd; -int i;CALLOC_ARRAY (pfd, socklist->nr); -for (i =0 ; i < socklist->nr; i++) { +for (size_t i =0 ; i < socklist->nr; i++) { pfd[i].fd = socklist->list[i]; pfd[i].events =POLLIN ; }
@@ -1135,8 +1132,6 @@ static int service_loop(struct socketlist *socklist)signal (SIGCHLD , child_handler);for (;;) { -int i; -check_dead_children ();if (poll (pfd, socklist->nr,-1 ) <0 ) {
@@ -1148,7 +1143,7 @@ static int service_loop(struct socketlist *socklist)continue ; } -for (i =0 ; i < socklist->nr; i++) { +for (size_t i =0 ; i < socklist->nr; i++) {if (pfd[i].revents &POLLIN ) { union { struct sockaddr sa;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 10/15 daemon: fix type of `max_connections`
In reply to Patrick SteinhardtThe max_connections type tracks how many children git-daemon(1) would spawn at the same time. This value can be controlled via a command line
switch: if given a positive value we'll set that up as the limit. But when given either zero or a negative value we don't enforce any limit at all.
But even when being passed a negative value we won't actually store it, but normalize it to 0. Still, the variable used to store the config is using a signed integer, which causes warnings when comparing the number of accepted connections (max_connections) with the number of current connections being handled (live_children).
Adapt the type of max_connections such that the types of both variables match.
--- daemon.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
daemon.c +5 -6
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
@@ -801,8 +800,7 @@ static int addrcmp(const struct sockaddr_storage *s1,return 0 ; } -static int max_connections =32 ; - +static unsigned int max_connections =32 ;static unsigned int live_children; static struct child {
@@ -1315,10 +1313,11 @@ int cmd_main(int argc, const char **argv)continue ; }if (skip_prefix (arg,"--max-connections=" , &v)) { -if (strtol_i (v,10 , &max_connections)) +int parsed_value; +if (strtol_i (v,10 , &parsed_value))die (_ ("invalid max-connections '%s', expecting an integer" ), v); -if (max_connections <0 ) - max_connections =0 ;/* unlimited */ +/* A negative value indicates unlimited children. */ + max_connections = parsed_value <0 ?0 : parsed_value;continue ; }if (!strcmp (arg,"--strict-paths" )) {
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 11/15 gpg-interface: address -Wsign-comparison warnings
In reply to Patrick SteinhardtThere are a couple of -Wsign-comparison warnings in "gpg-interface.c". Most of them are trivial and simply using signed integers to loop towards an upper unsigned bound.
But in parse_signed_buffer() we have one case where the different signedness of the two values of a ternary expression results in a warning. Given that:
- size will always be bigger than len due to the loop condition.
- eol will always be after buf + len because it is found via memchr(3p) starting from buf + len.
We know that both values will always be natural integers.
Squelch the warning by casting the left-hand side to size_t.
--- gpg-interface.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
gpg-interface.c +6 -9
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
@@ -128,9 +127,7 @@ static struct gpg_format *use_format = &gpg_format[0];static struct gpg_format *get_format_by_name (const char *str) { -int i; - -for (i =0 ; i <ARRAY_SIZE (gpg_format); i++) +for (size_t i =0 ; i <ARRAY_SIZE (gpg_format); i++)if (!strcmp (gpg_format[i].name, str))return gpg_format + i;return NULL ;
@@ -138,9 +135,9 @@ static struct gpg_format *get_format_by_name(const char *str)static struct gpg_format *get_format_by_sig (const char *sig) { -int i, j; +int j; -for (i =0 ; i <ARRAY_SIZE (gpg_format); i++) +for (size_t i =0 ; i <ARRAY_SIZE (gpg_format); i++)for (j =0 ; gpg_format[i].sigs[j]; j++)if (starts_with (sig, gpg_format[i].sigs[j]))return gpg_format + i;
@@ -228,7 +225,7 @@ static void parse_gpg_output(struct signature_check *sigc) {const char *buf = sigc->gpg_status;const char *line, *next; -int i, j; +int j;int seen_exclusive_status =0 ;/* Iterate over all lines */
@@ -243,7 +240,7 @@ static void parse_gpg_output(struct signature_check *sigc)continue ;/* Iterate over all search strings */ -for (i =0 ; i <ARRAY_SIZE (sigcheck_gpg_status); i++) { +for (size_t i =0 ; i <ARRAY_SIZE (sigcheck_gpg_status); i++) {if (skip_prefix (line, sigcheck_gpg_status[i].check, &line)) {/* * GOODSIG, BADSIG etc. can occur only once for
@@ -700,7 +697,7 @@ size_t parse_signed_buffer(const char *buf, size_t size) match = len; eol =memchr (buf + len,'\n' , size - len); - len += eol ? eol - (buf + len) +1 : size - len; + len += eol ? (size_t ) (eol - (buf + len) +1 ) : size - len; }return match; }
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 12/15 builtin/blame: fix type of `length` variable when emitting object ID
In reply to Patrick SteinhardtThe length variable is used to store how many bytes we wish to emit from an object ID. This value will either be the full hash algorithm's length, or the abbreviated hash that can be set via --abbrev or the "core.abbrev" option. The former is of type size_t, whereas the latter is of type int, which causes a warning with "-Wsign-compare".
The reason why abbrev is using a signed type is mostly that it is initialized with -1 to indicate that we have to compute the minimum abbreviation length. This length is computed via find_alignment(), which always gets called before emit_other(), and thus we can assume that the value would never be negative in emit_other().
In fact, we can even assume that the value will always be at least MINIMUM_ABBREV, which is enforced by both git_default_core_config() and parse_opt_abbrev_cb(). We implicitly rely on this by subtracting up to 3 without checking for whether the value becomes negative. We then pass the value to printf(3p) to print the prefix of our object's ID, so if that assumption was violated we may end up with undefined behaviour.
Squelch the warning by asserting this invariant and casting the value of abbrev to size_t. This allows us to store the whole length as an unsigned integer, which we can then pass to fwrite().
--- builtin/blame.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
builtin/blame.c +7 -3
@@ -6,7 +6,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -468,9 +467,14 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int reset =GIT_COLOR_RESET ; } +if (abbrev <MINIMUM_ABBREV ) +BUG ("abbreviation is smaller than minimum length: %d < %d" , + abbrev,MINIMUM_ABBREV ); +for (cnt =0 ; cnt < ent->num_lines; cnt++) {char ch; -int length = (opt &OUTPUT_LONG_OBJECT_NAME ) ? the_hash_algo->hexsz : abbrev; +size_t length = (opt &OUTPUT_LONG_OBJECT_NAME ) ? + the_hash_algo->hexsz : (size_t ) abbrev;if (opt &OUTPUT_COLOR_LINE ) {if (cnt >0 ) {
@@ -501,7 +505,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int length--;putchar ('?' ); } -printf ("%.*s" , length, hex); +fwrite (hex,1 , length, stdout);if (opt &OUTPUT_ANNOTATE_COMPAT ) {const char *name;if (opt &OUTPUT_SHOW_EMAIL )
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 13/15 builtin/patch-id: fix type of `get_one_patchid()`
In reply to Patrick SteinhardtIn get_one_patchid() we assign either the result of strlen() or remove_space() to len. But while the former correctly returns a size_t, the latter returns an int to indicate the length of the stripped string even though it cannot ever return a negative value. This causes a warning with "-Wsign-conversion".
In fact, even get_one_patchid() itself is also using an integer as return value even though it always returns the length of the patch, and this bubbles up to other callers.
Adapt the function and its helpers to use size_t for string lengths consistently.
--- builtin/patch-id.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
builtin/patch-id.c +8 -8
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
@@ -10,13 +9,13 @@#include "parse-options.h" #include "setup.h" -static void flush_current_id (int patchlen,struct object_id *id,struct object_id *result) +static void flush_current_id (size_t patchlen,struct object_id *id,struct object_id *result) {if (patchlen)printf ("%s %s\n" ,oid_to_hex (result),oid_to_hex (id)); } -static int remove_space (char *line) +static size_t remove_space (char *line) {char *src = line;char *dst = line;
@@ -63,10 +62,11 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after)return 1 ; } -static int get_one_patchid (struct object_id *next_oid,struct object_id *result, -struct strbuf *line_buf,int stable,int verbatim) +static size_t get_one_patchid (struct object_id *next_oid,struct object_id *result, +struct strbuf *line_buf,int stable,int verbatim) { -int patchlen =0 , found_next =0 ; +size_t patchlen =0 ; +int found_next =0 ;int before =-1 , after =-1 ;int diff_is_binary =0 ;char pre_oid_str[GIT_MAX_HEXSZ +1 ], post_oid_str[GIT_MAX_HEXSZ +1 ];
@@ -78,7 +78,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,while (strbuf_getwholeline (line_buf, stdin,'\n' ) !=EOF ) {char *line = line_buf->buf;const char *p = line; -int len; +size_t len;/* Possibly skip over the prefix added by "log" or "format-patch" */ if (!skip_prefix(line, "commit ", &p) &&
@@ -179,7 +179,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,static void generate_id_list (int stable,int verbatim) {struct object_id oid, n, result; -int patchlen; +size_t patchlen;struct strbuf line_buf =STRBUF_INIT ;oidclr (&oid, the_repository->hash_algo);
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 14/15 scalar: address -Wsign-compare warnings
In reply to Patrick SteinhardtThere are two -Wsign-compare warnings in "scalar.c", both of which are trivial:
- We mistakenly use a signed integer to loop towards an upper unsigned bound in cmd_reconfigure().
- We subtract path_sep - enlistment->buf, which results in a signed integer, and use the value in a ternary expression where second value is unsigned. But as path_sep is being assigned the result of find_last_dir_sep(enlistment->buf + offset) we know that it must always be bigger than or equal to enlistment->buf, and thus the result will be positive.
Address both of these warnings.
--- scalar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
scalar.c +3 -4
@@ -3,7 +3,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
@@ -380,7 +379,7 @@ static int delete_enlistment(struct strbuf *enlistment) offset =offset_1st_component (enlistment->buf); path_sep =find_last_dir_sep (enlistment->buf + offset);strbuf_add (&parent, enlistment->buf, - path_sep ? path_sep - enlistment->buf : offset); + path_sep ? (size_t ) (path_sep - enlistment->buf) : offset);if (chdir (parent.buf) <0 ) {int res =error_errno (_ ("could not switch to '%s'" ), parent.buf);strbuf_release (&parent);
@@ -655,7 +654,7 @@ static int cmd_reconfigure(int argc, const char **argv)NULL };struct string_list scalar_repos =STRING_LIST_INIT_DUP ; -int i, res =0 ; +int res =0 ;struct strbuf commondir =STRBUF_INIT , gitdir =STRBUF_INIT ; argc = parse_options(argc, argv, NULL, options,
@@ -673,7 +672,7 @@ static int cmd_reconfigure(int argc, const char **argv)git_config (get_scalar_repos, &scalar_repos); -for (i =0 ; i < scalar_repos.nr; i++) { +for (size_t i =0 ; i < scalar_repos.nr; i++) {int succeeded =0 ;struct repository *old_repo, r = {NULL };const char *dir = scalar_repos.items[i].string;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v3 15/15 t/helper: don't depend on implicit wraparound
In reply to Patrick SteinhardtIn our test helpers we have two cases where we assign -1 to an unsigned long. The intent is to essentially mean "unbounded output", which is achieved via implicit wraparound of the value.
This pattern causes warnings with -Wsign-compare though. Adapt it and instead use ULONG_MAX explicitly.
--- t/helper/test-csprng.c | 5 +---- t/helper/test-genrandom.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-)
t/helper/test-csprng.c +1 -4
@@ -1,9 +1,6 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-tool.h" #include "git-compat-util.h" -int cmd__csprng (int argc,const char **argv) {unsigned long count;
@@ -14,7 +11,7 @@ int cmd__csprng(int argc, const char **argv)return 2 ; } - count = (argc ==2 ) ?strtoul (argv[1 ],NULL ,0 ) :-1L ; + count = (argc ==2 ) ?strtoul (argv[1 ],NULL ,0 ) :ULONG_MAX ;while (count) {unsigned long chunk = count <sizeof (buf) ? count :sizeof (buf);
t/helper/test-genrandom.c +1 -3
@@ -4,8 +4,6 @@* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2. */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "test-tool.h" #include "git-compat-util.h"
@@ -24,7 +22,7 @@ int cmd__genrandom(int argc, const char **argv) next = next *11 + *c; }while (*c++); - count = (argc ==3 ) ?strtoul (argv[2 ],NULL ,0 ) :-1L ; + count = (argc ==3 ) ?strtoul (argv[2 ],NULL ,0 ) :ULONG_MAX ;while (count--) { next = next *1103515245 +12345 ;
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
v4 cover Start compiling with `-Wsign-compare`
In reply to Patrick SteinhardtHi,
when compiling with DEVELOPER=YesPlease, we explicitly disable the "-Wsign-compare" warning. This is mostly because our code base is full of cases where we don't bother at all whether something should be signed or unsigned, and enabling the warning would thus cause tons of warnings to pop up.
Unfortunately, disabling this warning also masks real issues. There have been multiple CVEs in the Git project that would have been flagged by this warning (e.g. CVE-2022-39260, CVE-2022-41903 and several fixes in the vicinity of these CVEs). Furthermore, the final audit report by X41 D-Sec, who are the ones who have discovered some of the CVEs, hinted that it might be a good idea to become more strict in this context.
Now simply enabling the warning globally does not fly due to the stated reason above that we simply have too many sites where we use the wrong integer types. Instead, this patch series introduces a new macro that allows us to explicitly mark files that generate such warnings. Like this, we can adapt the codebase over time and hopefully make this class of vulnerabilities harder to land.
Changes in v2:
- Explode the 6th patch into multiple patches with more careful analysis and refactorings
- Drop the conversion of "gettext.c". To do it properly we'd have to fix the return type of utf8_strwidth(), which we have already marked as a todo.
- Link to v1: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Include Junio's fix for 32 bit platforms.
- Improve a commit message.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Rebased on top of e66fd72e97 (The fourteenth batch, 2024-12-06) to fix a couple of new errors in "git.c"'
- Remove needless cast in "csum-file.c".
- Refactor "pkt-line.c" to be safer regarding integer conversions.
- Link to v3: https://lore.kernel.org/r/[email protected]
There are a couple of trivial conflicts with kn/midx-wo-the-repository, but I don't think it makes sense to make that a dependency of this series. Let me know in case you disagree and I'll change the base of this series.
Thanks!
Patrick
---
Junio C Hamano (1):
csum-file: fix -Wsign-compare warning on 32-bit platform
Patrick Steinhardt (15):
git-compat-util: introduce macros to disable "-Wsign-compare" warnings compat/regex: explicitly ignore "-Wsign-compare" warnings compat/win32: fix -Wsign-compare warning in "wWinMain()"
global: mark code units that generate warnings with -Wsign-compare config.mak.dev: drop -Wno-sign-compare
diff.h: fix index used to loop through unsigned integer
pkt-line: fix -Wsign-compare warning on 32 bit platform
global: trivial conversions to fix -Wsign-compare warnings
daemon: fix loops that have mismatching integer types
daemon: fix type of max_connections
gpg-interface: address -Wsign-comparison warnings builtin/blame: fix type of length variable when emitting object ID builtin/patch-id: fix type of get_one_patchid()
scalar: address -Wsign-compare warnings
t/helper: don't depend on implicit wraparound
add-interactive.c | 1 + add-patch.c | 1 + advice.c | 7 ++----- apply.c | 1 + archive.c | 1 + attr.c | 1 + base85.c | 3 +-- bisect.c | 1 + blame.c | 1 + bloom.c | 2 ++ builtin/add.c | 9 +++++---- builtin/am.c | 1 + builtin/bisect.c | 2 ++ builtin/blame.c | 11 +++++++++-- builtin/branch.c | 2 ++ builtin/cat-file.c | 3 +++ builtin/checkout--worker.c | 2 ++ builtin/checkout-index.c | 3 +++ builtin/checkout.c | 2 ++ builtin/clean.c | 3 +++ builtin/clone.c | 3 +++ builtin/commit.c | 3 +++ builtin/describe.c | 2 ++ builtin/diff-files.c | 3 +++ builtin/diff-index.c | 2 ++ builtin/diff-tree.c | 1 + builtin/diff.c | 3 +++ builtin/difftool.c | 5 ++++- builtin/fast-export.c | 3 +++ builtin/fast-import.c | 2 ++ builtin/fetch-pack.c | 2 ++ builtin/fetch.c | 3 +++ builtin/for-each-repo.c | 5 +++-- builtin/fsmonitor--daemon.c | 2 ++ builtin/gc.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 6 +++--- builtin/index-pack.c | 2 ++ builtin/log.c | 3 +++ builtin/ls-files.c | 3 +++ builtin/mailsplit.c | 6 ++++-- builtin/merge-file.c | 2 ++ builtin/merge-index.c | 2 ++ builtin/merge-ours.c | 2 ++ builtin/merge-tree.c | 6 +++--- builtin/merge.c | 3 +++ builtin/mv.c | 2 ++ builtin/name-rev.c | 2 ++ builtin/pack-objects.c | 2 ++ builtin/pack-redundant.c | 4 ++-- builtin/pack-refs.c | 1 + builtin/patch-id.c | 16 +++++++++------- builtin/prune.c | 2 ++ builtin/pull.c | 4 ++-- builtin/push.c | 6 ++++-- builtin/range-diff.c | 1 + builtin/rebase.c | 3 +++ builtin/receive-pack.c | 2 ++ builtin/reflog.c | 1 + builtin/remote.c | 2 ++ builtin/repack.c | 2 ++ builtin/replay.c | 4 +++- builtin/rerere.c | 9 +++++---- builtin/reset.c | 2 ++ builtin/rev-list.c | 2 ++ builtin/rev-parse.c | 3 +++ builtin/revert.c | 1 + builtin/rm.c | 3 +++ builtin/shortlog.c | 1 + builtin/show-branch.c | 2 ++ builtin/show-index.c | 2 ++ builtin/sparse-checkout.c | 2 ++ builtin/stash.c | 7 +++---- builtin/submodule--helper.c | 8 ++++---- builtin/tag.c | 3 +++ builtin/unpack-objects.c | 2 ++ builtin/update-index.c | 3 +++ builtin/update-ref.c | 2 ++ builtin/var.c | 5 +++-- builtin/worktree.c | 2 ++ bulk-checkin.c | 1 + bundle-uri.c | 1 + bundle.c | 1 + cache-tree.c | 1 + chunk-format.c | 1 + color.c | 2 ++ column.c | 2 ++ combine-diff.c | 1 + commit-graph.c | 1 + commit-reach.c | 1 + commit.c | 3 +-- compat/fsmonitor/fsm-listen-darwin.c | 3 +-- compat/mingw.c | 1 + compat/poll/poll.c | 2 ++ compat/regex/regex.c | 2 ++ compat/terminal.c | 3 +-- compat/win32/headless.c | 17 +++++++++-------- compat/win32mmap.c | 2 ++ compat/winansi.c | 2 ++ config.c | 1 + config.mak.dev | 1 - connect.c | 1 + convert.c | 1 + credential.c | 1 + csum-file.c | 2 +- daemon.c | 31 +++++++++++++------------------ date.c | 2 ++ decorate.c | 3 +++ delta-islands.c | 1 + diagnose.c | 7 +++---- diff-delta.c | 2 ++ diff-lib.c | 1 + diff-no-index.c | 2 ++ diff.c | 1 + diff.h | 3 +-- diffcore-order.c | 1 + diffcore-pickaxe.c | 3 +++ diffcore-rename.c | 3 +-- diffcore-rotate.c | 1 + dir.c | 1 + entry.c | 4 ++-- ewah/ewah_bitmap.c | 5 ++--- ewah/ewah_io.c | 3 +++ ewah/ewah_rlw.c | 3 +++ fetch-pack.c | 1 + fmt-merge-msg.c | 1 + fsmonitor.c | 1 + gettext.c | 2 ++ git-compat-util.h | 10 ++++++++++ git.c | 32 +++++++++++++------------------- gpg-interface.c | 14 ++++++-------- graph.c | 1 + grep.c | 2 ++ help.c | 1 + help.h | 8 +++----- hex.c | 6 ++---- http-backend.c | 1 + http-push.c | 3 +-- http-walker.c | 1 + http.c | 1 + imap-send.c | 1 + json-writer.c | 2 ++ kwset.c | 2 ++ line-log.c | 2 ++ list-objects-filter-options.c | 4 +--- list-objects.c | 7 ++----- log-tree.c | 1 + ls-refs.c | 4 +--- mailinfo.c | 1 + mailmap.c | 1 + match-trees.c | 1 + mem-pool.c | 2 ++ merge-ll.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + merge.c | 4 ++-- midx-write.c | 1 + midx.c | 1 + name-hash.c | 1 + notes-merge.c | 1 + notes.c | 1 + object-file-convert.c | 1 + object-file.c | 1 + object-name.c | 1 + object.c | 1 + pack-bitmap-write.c | 1 + pack-bitmap.c | 1 + pack-check.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + path.c | 4 ++-- pathspec.c | 1 + pkt-line.c | 23 ++++++++++++----------- preload-index.c | 1 + pretty.c | 1 + progress.c | 1 + pseudo-merge.c | 1 + quote.c | 2 ++ range-diff.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog.c | 1 + refs.c | 1 + refs/debug.c | 3 +-- refs/files-backend.c | 1 + refs/iterator.c | 2 ++ refs/packed-backend.c | 1 + refspec.c | 1 + reftable/system.h | 2 ++ remote-curl.c | 1 + remote.c | 1 + rerere.c | 1 + resolve-undo.c | 1 + revision.c | 1 + run-command.c | 1 + scalar.c | 6 +++--- send-pack.c | 5 ++--- sequencer.c | 1 + serve.c | 7 ++----- server-info.c | 1 + setup.c | 1 + shallow.c | 1 + sideband.c | 1 + sparse-index.c | 1 + split-index.c | 1 + strbuf.c | 2 ++ string-list.c | 2 ++ strvec.c | 3 +-- submodule-config.c | 1 + submodule.c | 1 + symlinks.c | 2 ++ t/helper/test-bloom.c | 9 ++------- t/helper/test-cache-tree.c | 1 + t/helper/test-config.c | 1 + t/helper/test-csprng.c | 3 +-- t/helper/test-drop-caches.c | 2 ++ t/helper/test-dump-fsmonitor.c | 3 +-- t/helper/test-dump-split-index.c | 3 +-- t/helper/test-dump-untracked-cache.c | 6 +++--- t/helper/test-genrandom.c | 2 +- t/helper/test-genzeros.c | 2 ++ t/helper/test-hash-speed.c | 5 ++--- t/helper/test-mergesort.c | 2 ++ t/helper/test-parse-options.c | 5 ++--- t/helper/test-path-utils.c | 1 + t/helper/test-reach.c | 3 +-- t/helper/test-ref-store.c | 3 +-- t/helper/test-run-command.c | 2 ++ t/helper/test-string-list.c | 2 ++ t/helper/test-tool.c | 3 +-- t/helper/test-trace2.c | 1 + t/unit-tests/lib-reftable.c | 2 ++ t/unit-tests/t-example-decorate.c | 4 ++-- t/unit-tests/t-prio-queue.c | 2 +- t/unit-tests/t-reftable-readwrite.c | 2 ++ t/unit-tests/t-reftable-stack.c | 2 ++ t/unit-tests/t-trailer.c | 2 ++ t/unit-tests/test-lib.c | 2 ++ tag.c | 1 + tmp-objdir.c | 3 +-- trace.c | 1 + trace2.c | 2 ++ trace2/tr2_sysenv.c | 2 ++ trace2/tr2_tgt_event.c | 2 ++ trace2/tr2_tgt_perf.c | 2 ++ trailer.c | 3 +-- transport-helper.c | 13 ++++++------- transport.c | 13 ++++--------- tree-diff.c | 1 + unix-socket.c | 2 ++ unpack-trees.c | 1 + upload-pack.c | 1 + urlmatch.c | 2 ++ usage.c | 3 ++- userdiff.c | 1 + utf8.c | 2 ++ version.c | 3 +-- versioncmp.c | 3 +-- worktree.c | 1 + wrapper.c | 3 +++ ws.c | 3 +++ wt-status.c | 1 + xdiff-interface.c | 1 + xdiff/xdiffi.c | 1 + xdiff/xinclude.h | 2 ++ 265 files changed, 519 insertions(+), 235 deletions(-)
Range-diff versus v3:
1: db200b32a4 = 1: 4b1b789a11 git-compat-util: introduce macros to disable "-Wsign-compare" warnings
2: d2f39d9cdd = 2: 9374c60f7a compat/regex: explicitly ignore "-Wsign-compare" warnings
3: 195adf8638 = 3: 5e171b5c88 compat/win32: fix -Wsign-compare warning in "wWinMain()"
4: 5d1169e388 ! 4: 05f2d3b693 global: mark code units that generate warnings with `-Wsign-compare`
@@ refs/files-backend.c
+#define DISABLE_SIGN_COMPARE_WARNINGS
#include "../git-compat-util.h"
- #include "../config.h"
+ #include "../abspath.h"
## refs/iterator.c ##
@@
5: 54f765cd2a = 5: dd1182224a config.mak.dev: drop `-Wno-sign-compare`
6: d40c804a80 = 6: 14623c961b diff.h: fix index used to loop through unsigned integer
7: bc629478af ! 7: 8647bcb017 sign-compare: 32-bit support @@ Metadata
Author: Junio C Hamano <[email protected]>
## Commit message ##
- sign-compare: 32-bit support
+ csum-file: fix -Wsign-compare warning on 32-bit platform
On 32-bit platforms, ssize_t may be "int" while size_t may be "unsigned int". At times we compare the number of bytes we read
@@ csum-file.c: static void verify_buffer_or_die(struct hashfile *f,
if (ret < 0)
die_errno("%s: sha1 file read error", f->name);
- if (ret != count)
-+ if ((size_t)ret != (size_t)count)
++ if ((size_t)ret != count)
die("%s: sha1 file truncated", f->name);
if (memcmp(buf, f->check_buffer, count))
die("sha1 file '%s' validation error", f->name);
-
- ## pkt-line.c ##
-@@ pkt-line.c: static int get_packet_data(int fd, char **src_buf, size_t *src_size,
- }
-
- /* And complain if we didn't get enough bytes to satisfy the read. */
-- if (ret != size) {
-+ if ((size_t)ret != (size_t)size) {
- if (options & PACKET_READ_GENTLE_ON_EOF)
- return -1;
-
-: ---------- > 8: ea870e7d7b pkt-line: fix -Wsign-compare warning on 32 bit platform 8: 3dfb3dac4c ! 9: 482020af4b global: trivial conversions to fix `-Wsign-compare` warnings
@@ git.c: void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
if (skip_prefix(commands[i].cmd, prefix, &name))
add_cmdname(cmds, name, strlen(name));
}
-@@ git.c: static int run_argv(int *argcp, const char ***argv)
+@@ git.c: static int run_argv(struct strvec *args)
+ handle_builtin(args);
+ else if (get_builtin(args->v[0])) {
+ struct child_process cmd = CHILD_PROCESS_INIT;
+- int i;
++ int err;
+
+ /*
+ * The current process is committed to launching a
+@@ git.c: static int run_argv(struct strvec *args)
+ commit_pager_choice();
+
+ strvec_push(&cmd.args, "git");
+- for (i = 0; i < args->nr; i++)
++ for (size_t i = 0; i < args->nr; i++)
+ strvec_push(&cmd.args, args->v[i]);
+
+ trace_argv_printf(cmd.args.v, "trace: exec:");
+@@ git.c: static int run_argv(struct strvec *args)
+ cmd.clean_on_exit = 1;
+ cmd.wait_after_clean = 1;
+ cmd.trace2_child_class = "git_alias";
+- i = run_command(&cmd);
+- if (i >= 0 || errno != ENOENT)
+- exit(i);
++ err = run_command(&cmd);
++ if (err >= 0 || errno != ENOENT)
++ exit(err);
+ die("could not execute builtin %s", args->v[0]);
+ }
- seen = unsorted_string_list_lookup(&cmd_list, *argv[0]);
+@@ git.c: static int run_argv(struct strvec *args)
+
+ seen = unsorted_string_list_lookup(&cmd_list, args->v[0]);
if (seen) {
- int i;
struct strbuf sb = STRBUF_INIT;
@@ git.c: static int run_argv(int *argcp, const char ***argv)
struct string_list_item *item = &cmd_list.items[i];
strbuf_addf(&sb, "\n %s", item->string);
+@@ git.c: int cmd_main(int argc, const char **argv)
+ */
+ setup_path();
+
+- for (size_t i = 0; i < argc; i++)
++ for (int i = 0; i < argc; i++)
+ strvec_push(&args, argv[i]);
+
+ while (1) {
## help.h ##
@@ help.h: static inline void list_config_item(struct string_list *list,
9: e958cdf2a7 = 10: 9b3939369e daemon: fix loops that have mismatching integer types 10: 817d83e78c = 11: 20b4332a90 daemon: fix type of `max_connections` 11: c926562a6d = 12: 3708125de5 gpg-interface: address -Wsign-comparison warnings 12: 806d118aae = 13: 74710deea7 builtin/blame: fix type of `length` variable when emitting object ID 13: c47920d71a = 14: 7527b49737 builtin/patch-id: fix type of `get_one_patchid()` 14: e346768f65 = 15: 2b3c65b3f4 scalar: address -Wsign-compare warnings 15: f39ffd3073 = 16: aac99381ff t/helper: don't depend on implicit wraparound
---
base-commit: e66fd72e972df760a53c3d6da023c17adfc426d6
change-id: 20241128-pks-sign-compare-9cf7412bce1a
PATCH v4 1/16 git-compat-util: introduce macros to disable "-Wsign-compare" warnings
When compiling with DEVELOPER=YesPlease, we explicitly disable the "-Wsign-compare" warning. This is mostly because our code base is full of cases where we don't bother at all whether something should be signed or unsigned, and enabling the warning would thus cause tons of warnings to pop up.
Unfortunately, disabling this warning also masks real issues. There have been multiple CVEs in the Git project that would have been flagged by this warning (e.g. CVE-2022-39260, CVE-2022-41903 and several fixes in the vicinity of these CVEs). Furthermore, the final audit report by X41 D-Sec, who are the ones who have discovered some of the CVEs, hinted that it might be a good idea to become more strict in this context.
Now simply enabling the warning globally does not fly due to the stated reason above that we simply have too many sites where we use the wrong integer types. Instead, introduce a new set of macros that allow us to mark a file as being free of warnings with "-Wsign-compare". The mechanism is similar to what we do with USE_THE_REPOSITORY_VARIABLE:
every file that is not marked with DISABLE_SIGN_COMPARE_WARNINGS will be compiled with those warnings enabled.
These new markings will be wired up in the subsequent commits.
--- git-compat-util.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
git-compat-util.h +10 -0
@@ -44,6 +44,16 @@ struct strbuf;#define GIT_GNUC_PREREQ (maj, min) 0#endif +#if defined(__GNUC__) || defined(__clang__) +# define PRAGMA (pragma) _Pragma(#pragma) +# define DISABLE_WARNING (warning) PRAGMA(GCC diagnostic ignored #warning) +#else +# define DISABLE_WARNING (warning) +#endif + +#ifdef DISABLE_SIGN_COMPARE_WARNINGS +DISABLE_WARNING(-Wsign-compare) +#endif #ifndef FLEX_ARRAY /*
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
Re: [PATCH v4 01/16] git-compat-util: introduce macros to disable "-Wsign-compare" warnings
Patrick Steinhardt <[email protected]> writes:
[snip]
git-compat-util.h struct strbuf; · line 49
Quoted 11 lines
git-compat-util.h +3
-0@@ -44,6 +44,16 @@ struct strbuf;#define GIT_GNUC_PREREQ (maj, min) 0#endif +#if defined(__GNUC__) || defined(__clang__) +# define PRAGMA (pragma) _Pragma(#pragma) +# define DISABLE_WARNING (warning) PRAGMA(GCC diagnostic ignored #warning)
Seems like clang [1] also support #pragma GCC diagnostic, so this works with both.
git-compat-util.h struct strbuf; · line 56
Quoted 7 lines
git-compat-util.h +7
-0+#else +# define DISABLE_WARNING (warning) +#endif + +#ifdef DISABLE_SIGN_COMPARE_WARNINGS +DISABLE_WARNING(-Wsign-compare) +#endif
Looks good.
Thanks
[1]: https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas
PATCH v4 2/16 compat/regex: explicitly ignore "-Wsign-compare" warnings
In reply to Patrick SteinhardtExplicitly ignore "-Wsign-compare" warnings in our bundled copy of the regcomp implementation. We don't use the macro introduced in the preceding commit because this code does not include "git-compat-util.h" in the first place.
Note that we already directly use "#pragma GCC diagnostic ignored" in "regcomp.c", so it shouldn't be an issue to use it directly in the new spot, either.
--- compat/regex/regex.c | 2 ++ 1 file changed, 2 insertions(+)
compat/regex/regex.c +2 -0
@@ -17,6 +17,8 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#pragma GCC diagnostic ignored "-Wsign-compare" +#ifdef HAVE_CONFIG_H #include "config.h" #endif
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v4 3/16 compat/win32: fix -Wsign-compare warning in "wWinMain()"
In reply to Patrick SteinhardtGCC generates a warning in "headless.c" because we compare slash with size, where the former is an int and the latter is a size_t. Fix the warning by storing slash as a size_t, as well.
This commit is being singled out because the file does not include the "git-compat-util.h" header, and consequently, we cannot easily mark it with the DISABLE_SIGN_COMPARE_WARNING macro.
--- compat/win32/headless.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
compat/win32/headless.c +9 -8
@@ -53,7 +53,8 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,wchar_t git_command_line[32768 ];size_t size =sizeof (git_command_line) /sizeof (wchar_t);const wchar_t *needs_quotes =L"" ; -int slash =0 , i; +size_t slash =0 ; +int len;STARTUPINFO startup_info = { .cb =sizeof (STARTUPINFO ),
@@ -66,7 +67,7 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,DWORD exit_code;/* First, determine the full path of argv[0] */ -for (i =0 ; _wpgmptr[i]; i++) +for (size_t i =0 ; _wpgmptr[i]; i++)if (_wpgmptr[i] ==L' ' ) needs_quotes =L"\"" ;else if (_wpgmptr[i] ==L'\\' )
@@ -79,16 +80,16 @@ int WINAPI wWinMain(_In_ HINSTANCE instance,extend_path (_wpgmptr, slash);/* Then, add the full path of `git.exe` as argv[0] */ - i =swprintf_s (git_command_line, size,L"%ls%.*ls\\git.exe%ls" , - needs_quotes, slash, _wpgmptr, needs_quotes); -if (i <0 ) + len =swprintf_s (git_command_line, size,L"%ls%.*ls\\git.exe%ls" , + needs_quotes, (int ) slash, _wpgmptr, needs_quotes); +if (len <0 )return 127 ;/* Too long path */ if (*command_line) {/* Now, append the command-line arguments */ - i =swprintf_s (git_command_line + i, size - i, -L" %ls" , command_line); -if (i <0 ) + len =swprintf_s (git_command_line + len, size - len, +L" %ls" , command_line); +if (len <0 )return 127 ; }
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v4 4/16 global: mark code units that generate warnings with `-Wsign-compare`
In reply to Patrick SteinhardtMark code units that generate warnings with -Wsign-compare. This allows for a structured approach to get rid of all such warnings over time in a way that can be easily measured.
--- add-interactive.c | 1 + add-patch.c | 1 + advice.c | 2 ++ apply.c | 1 + archive.c | 1 + attr.c | 1 + base85.c | 2 ++ bisect.c | 1 + blame.c | 1 + bloom.c | 2 ++ builtin/add.c | 3 +++ builtin/am.c | 2 ++ builtin/bisect.c | 2 ++ builtin/blame.c | 3 +++ builtin/branch.c | 3 +++ builtin/cat-file.c | 3 +++ builtin/checkout--worker.c | 2 ++ builtin/checkout-index.c | 3 +++ builtin/checkout.c | 2 ++ builtin/clean.c | 3 +++ builtin/clone.c | 3 +++ builtin/commit.c | 3 +++ builtin/describe.c | 2 ++ builtin/diff-files.c | 3 +++ builtin/diff-index.c | 2 ++ builtin/diff-tree.c | 2 ++ builtin/diff.c | 3 +++ builtin/difftool.c | 3 +++ builtin/fast-export.c | 3 +++ builtin/fast-import.c | 2 ++ builtin/fetch-pack.c | 2 ++ builtin/fetch.c | 3 +++ builtin/for-each-repo.c | 2 ++ builtin/fsmonitor--daemon.c | 2 ++ builtin/gc.c | 3 +++ builtin/grep.c | 3 +++ builtin/help.c | 4 +++- builtin/index-pack.c | 2 ++ builtin/log.c | 3 +++ builtin/ls-files.c | 3 +++ builtin/mailsplit.c | 3 +++ builtin/merge-file.c | 2 ++ builtin/merge-index.c | 2 ++ builtin/merge-ours.c | 3 +++ builtin/merge-tree.c | 2 ++ builtin/merge.c | 3 +++ builtin/mv.c | 2 ++ builtin/name-rev.c | 2 ++ builtin/pack-objects.c | 2 ++ builtin/pack-redundant.c | 2 ++ builtin/pack-refs.c | 2 ++ builtin/patch-id.c | 2 ++ builtin/prune.c | 2 ++ builtin/pull.c | 2 ++ builtin/push.c | 3 +++ builtin/range-diff.c | 2 ++ builtin/rebase.c | 3 +++ builtin/receive-pack.c | 2 ++ builtin/reflog.c | 2 ++ builtin/remote.c | 2 ++ builtin/repack.c | 2 ++ builtin/replay.c | 4 +++- builtin/rerere.c | 2 ++ builtin/reset.c | 3 +++ builtin/rev-list.c | 2 ++ builtin/rev-parse.c | 3 +++ builtin/revert.c | 2 ++ builtin/rm.c | 3 +++ builtin/shortlog.c | 2 ++ builtin/show-branch.c | 2 ++ builtin/show-index.c | 2 ++ builtin/sparse-checkout.c | 2 ++ builtin/stash.c | 2 ++ builtin/submodule--helper.c | 2 ++ builtin/tag.c | 3 +++ builtin/unpack-objects.c | 2 ++ builtin/update-index.c | 3 +++ builtin/update-ref.c | 2 ++ builtin/var.c | 3 +++ builtin/worktree.c | 2 ++ bulk-checkin.c | 1 + bundle-uri.c | 1 + bundle.c | 1 + cache-tree.c | 1 + chunk-format.c | 1 + color.c | 2 ++ column.c | 2 ++ combine-diff.c | 1 + commit-graph.c | 1 + commit-reach.c | 1 + commit.c | 1 + compat/fsmonitor/fsm-listen-darwin.c | 2 ++ compat/mingw.c | 1 + compat/poll/poll.c | 2 ++ compat/terminal.c | 2 ++ compat/win32mmap.c | 2 ++ compat/winansi.c | 2 ++ config.c | 1 + connect.c | 1 + convert.c | 1 + credential.c | 1 + csum-file.c | 1 + daemon.c | 1 + date.c | 2 ++ decorate.c | 3 +++ delta-islands.c | 1 + diagnose.c | 1 + diff-delta.c | 2 ++ diff-lib.c | 1 + diff-merges.c | 2 ++ diff-no-index.c | 2 ++ diff.c | 1 + diffcore-order.c | 3 +++ diffcore-pickaxe.c | 3 +++ diffcore-rename.c | 1 + diffcore-rotate.c | 3 +++ dir.c | 1 + entry.c | 1 + ewah/ewah_bitmap.c | 3 +++ ewah/ewah_io.c | 3 +++ ewah/ewah_rlw.c | 3 +++ fetch-pack.c | 1 + fmt-merge-msg.c | 1 + fsmonitor.c | 1 + gettext.c | 2 ++ git.c | 1 + gpg-interface.c | 1 + graph.c | 1 + grep.c | 2 ++ help.c | 1 + hex.c | 1 + http-backend.c | 1 + http-push.c | 1 + http-walker.c | 1 + http.c | 1 + imap-send.c | 1 + json-writer.c | 2 ++ kwset.c | 2 ++ line-log.c | 2 ++ list-objects-filter-options.c | 1 + list-objects-filter.c | 1 + list-objects.c | 1 + log-tree.c | 1 + ls-refs.c | 1 + mailinfo.c | 1 + mailmap.c | 1 + match-trees.c | 1 + mem-pool.c | 2 ++ merge-ll.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + merge.c | 1 + midx-write.c | 1 + midx.c | 1 + name-hash.c | 1 + notes-merge.c | 1 + notes.c | 1 + object-file-convert.c | 1 + object-file.c | 1 + object-name.c | 1 + object.c | 1 + pack-bitmap-write.c | 1 + pack-bitmap.c | 1 + pack-check.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + patch-ids.c | 2 ++ path.c | 1 + pathspec.c | 1 + pkt-line.c | 2 ++ preload-index.c | 1 + pretty.c | 1 + progress.c | 1 + pseudo-merge.c | 1 + quote.c | 2 ++ range-diff.c | 1 + reachable.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog-walk.c | 1 + reflog.c | 1 + refs.c | 1 + refs/debug.c | 2 ++ refs/files-backend.c | 1 + refs/iterator.c | 2 ++ refs/packed-backend.c | 1 + refspec.c | 1 + reftable/system.h | 2 ++ remote-curl.c | 1 + remote.c | 1 + rerere.c | 1 + resolve-undo.c | 1 + revision.c | 1 + run-command.c | 1 + scalar.c | 1 + send-pack.c | 1 + sequencer.c | 1 + serve.c | 1 + server-info.c | 1 + setup.c | 1 + shallow.c | 1 + sideband.c | 1 + sparse-index.c | 1 + split-index.c | 1 + strbuf.c | 2 ++ string-list.c | 2 ++ strvec.c | 2 ++ submodule-config.c | 1 + submodule.c | 1 + symlinks.c | 2 ++ t/helper/test-bloom.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-config.c | 1 + t/helper/test-csprng.c | 2 ++ t/helper/test-drop-caches.c | 2 ++ t/helper/test-dump-fsmonitor.c | 1 + t/helper/test-dump-split-index.c | 1 + t/helper/test-dump-untracked-cache.c | 1 + t/helper/test-genrandom.c | 2 ++ t/helper/test-genzeros.c | 2 ++ t/helper/test-hash-speed.c | 2 ++ t/helper/test-mergesort.c | 2 ++ t/helper/test-parse-options.c | 2 ++ t/helper/test-path-utils.c | 1 + t/helper/test-reach.c | 1 + t/helper/test-ref-store.c | 1 + t/helper/test-revision-walking.c | 1 + t/helper/test-run-command.c | 2 ++ t/helper/test-string-list.c | 2 ++ t/helper/test-tool.c | 2 ++ t/helper/test-trace2.c | 1 + t/unit-tests/lib-reftable.c | 2 ++ t/unit-tests/t-example-decorate.c | 1 + t/unit-tests/t-prio-queue.c | 2 ++ t/unit-tests/t-reftable-readwrite.c | 2 ++ t/unit-tests/t-reftable-stack.c | 2 ++ t/unit-tests/t-trailer.c | 2 ++ t/unit-tests/test-lib.c | 2 ++ tag.c | 1 + tmp-objdir.c | 1 + trace.c | 1 + trace2.c | 2 ++ trace2/tr2_sysenv.c | 2 ++ trace2/tr2_tgt_event.c | 2 ++ trace2/tr2_tgt_perf.c | 2 ++ trailer.c | 1 + transport-helper.c | 1 + transport.c | 1 + tree-diff.c | 1 + unix-socket.c | 2 ++ unpack-trees.c | 1 + upload-pack.c | 1 + urlmatch.c | 2 ++ usage.c | 3 +++ userdiff.c | 1 + utf8.c | 2 ++ version.c | 1 + versioncmp.c | 1 + worktree.c | 1 + wrapper.c | 3 +++ ws.c | 3 +++ wt-status.c | 1 + xdiff-interface.c | 1 + xdiff/xdiffi.c | 1 + xdiff/xinclude.h | 2 ++ 265 files changed, 439 insertions(+), 2 deletions(-)
add-interactive.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "add-interactive.h"
add-patch.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "add-interactive.h"
advice.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "advice.h" #include "config.h"
apply.c +1 -0
@@ -8,6 +8,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
archive.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
attr.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
base85.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "base85.h"
bisect.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
blame.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "refs.h"
bloom.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "bloom.h" #include "diff.h"
builtin/add.c +3 -0
@@ -3,6 +3,9 @@* * Copyright (C) 2006 Linus Torvalds */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/am.c +2 -0
@@ -5,6 +5,8 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "advice.h"
builtin/bisect.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "copy.h" #include "environment.h"
builtin/blame.c +3 -0
@@ -4,7 +4,10 @@* Copyright (c) 2006, 2014 by its authors * See COPYING for licensing conditions */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "color.h"
builtin/branch.c +3 -0
@@ -4,7 +4,10 @@* Copyright (c) 2006 Kristian Høgsberg <[email protected]> * Based on git-branch.sh by Junio C Hamano. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "color.h"
builtin/cat-file.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "convert.h"
builtin/checkout--worker.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "entry.h"
builtin/checkout-index.c +3 -0
@@ -4,7 +4,10 @@* Copyright (C) 2005 Linus Torvalds * */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/checkout.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "branch.h"
builtin/clean.c +3 -0
@@ -5,7 +5,10 @@* * Based on git-clean.sh by Pavel Roskin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/clone.c +3 -0
@@ -7,7 +7,10 @@* * Clone a repository into a different directory that does not yet exist. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/commit.c +3 -0
@@ -4,7 +4,10 @@* Copyright (c) 2007 Kristian Høgsberg <[email protected]> * Based on git-commit.sh by Junio C Hamano and Linus Torvalds */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/describe.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "environment.h"
builtin/diff-files.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/diff-index.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/diff-tree.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/diff.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (c) 2006 Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "ewah/ewok.h"
builtin/difftool.c +3 -0
@@ -11,7 +11,10 @@* * Copyright (C) 2016 Johannes Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/fast-export.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) 2007 Johannes E. Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/fast-import.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "environment.h"
builtin/fetch-pack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "hex.h"
builtin/fetch.c +3 -0
@@ -1,7 +1,10 @@/* * "git fetch" */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/for-each-repo.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/fsmonitor--daemon.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/gc.c +3 -0
@@ -9,7 +9,10 @@* * Copyright (c) 2006 Shawn O. Pearce */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "date.h"
builtin/grep.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (c) 2006 Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "gettext.h"
builtin/help.c +3 -1
@@ -1,8 +1,10 @@ -/* * Builtin help command */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "exec-cmd.h"
builtin/index-pack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "delta.h"
builtin/log.c +3 -0
@@ -4,7 +4,10 @@* (C) Copyright 2006 Linus Torvalds * 2006 Junio Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/ls-files.c +3 -0
@@ -5,7 +5,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "convert.h"
builtin/mailsplit.c +3 -0
@@ -4,6 +4,9 @@* It just splits a mbox into a list of files: "0001" "0002" .. * so you can process them further from there. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "string-list.h"
builtin/merge-file.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "diff.h"
builtin/merge-index.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "hex.h" #include "read-cache-ll.h"
builtin/merge-ours.c +3 -0
@@ -7,7 +7,10 @@* * Pretend we resolved the heads, but declare our tree trumps everybody else. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "builtin.h" #include "diff.h"
builtin/merge-tree.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "tree-walk.h" #include "xdiff-interface.h"
builtin/merge.c +3 -0
@@ -5,7 +5,10 @@* * Based on git-merge.sh by Junio C Hamano. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/mv.c +2 -0
@@ -3,7 +3,9 @@* * Copyright (C) 2006 Johannes Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h"
builtin/name-rev.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "environment.h" #include "gettext.h"
builtin/pack-objects.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "environment.h" #include "gettext.h"
builtin/pack-redundant.c +2 -0
@@ -5,7 +5,9 @@* This file is licensed under the GPL v2. * */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h"
builtin/pack-refs.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/patch-id.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "diff.h"
builtin/prune.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "commit.h" #include "diff.h"
builtin/pull.c +2 -0
@@ -7,6 +7,8 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/push.c +3 -0
@@ -1,7 +1,10 @@/* * "git push" */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "branch.h"
builtin/range-diff.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "object-name.h"
builtin/rebase.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (c) 2018 Pratik Karki */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/receive-pack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/reflog.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/remote.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/repack.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "dir.h"
builtin/replay.c +3 -1
@@ -2,9 +2,11 @@* "git replay" builtin command */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" -#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "environment.h" #include "hex.h"
builtin/rerere.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/reset.c +3 -0
@@ -7,7 +7,10 @@* * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/rev-list.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "commit.h"
builtin/rev-parse.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h"
builtin/revert.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "builtin.h" #include "parse-options.h"
builtin/rm.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds 2006 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/shortlog.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "commit.h"
builtin/show-branch.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "environment.h"
builtin/show-index.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "gettext.h" #include "hash.h"
builtin/sparse-checkout.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "dir.h"
builtin/stash.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "config.h"
builtin/submodule--helper.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "environment.h"
builtin/tag.c +3 -0
@@ -5,7 +5,10 @@* Carlos Rica <[email protected]> * Based on git-tag.sh and mktag.c by Linus Torvalds. */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "advice.h" #include "config.h"
builtin/unpack-objects.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "bulk-checkin.h" #include "config.h"
builtin/update-index.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "bulk-checkin.h" #include "config.h"
builtin/update-ref.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "config.h" #include "gettext.h"
builtin/var.c +3 -0
@@ -3,7 +3,10 @@* * Copyright (C) Eric Biederman, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "attr.h"
builtin/worktree.c +2 -0
@@ -1,4 +1,6 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "builtin.h" #include "abspath.h" #include "advice.h"
bulk-checkin.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bulk-checkin.h"
bundle-uri.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bundle-uri.h"
bundle.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "lockfile.h"
cache-tree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
chunk-format.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "chunk-format.h"
color.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "color.h"
column.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "column.h"
combine-diff.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h"
commit-graph.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
commit-reach.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
commit.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h"
compat/fsmonitor/fsm-listen-darwin.c +2 -0
@@ -23,6 +23,8 @@#endif #endif +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "fsmonitor-ll.h" #include "fsm-listen.h"
compat/mingw.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "win32.h"
compat/poll/poll.c +2 -0
@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +/* To bump the minimum Windows version to Windows Vista */ #include "git-compat-util.h"
compat/terminal.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "compat/terminal.h" #include "gettext.h"
compat/win32mmap.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "../git-compat-util.h" void *git_mmap (void *start,size_t length,int prot,int flags,int fd,off_t offset)
compat/winansi.c +2 -0
@@ -4,6 +4,8 @@#undef NOGDI +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "../git-compat-util.h" #include <wingdi.h> #include <winreg.h>
config.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
connect.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
convert.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
credential.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
csum-file.c +1 -0
@@ -9,6 +9,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "progress.h"
daemon.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
date.c +2 -0
@@ -4,6 +4,8 @@* Copyright (C) Linus Torvalds, 2005 */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "date.h" #include "gettext.h"
decorate.c +3 -0
@@ -2,6 +2,9 @@* decorate.c - decorate a git object with some arbitrary * data. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "object.h" #include "decorate.h"
delta-islands.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object.h"
diagnose.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diagnose.h"
diff-delta.c +2 -0
@@ -11,6 +11,8 @@* published by the Free Software Foundation. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "delta.h"
diff-lib.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
diff-merges.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diff-merges.h"
diff-no-index.c +2 -0
@@ -4,6 +4,8 @@* Copyright (c) 2008 by Junio C Hamano */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "abspath.h" #include "color.h"
diff.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
diffcore-order.c +3 -0
@@ -1,6 +1,9 @@/* * Copyright (C) 2005 Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
diffcore-pickaxe.c +3 -0
@@ -2,6 +2,9 @@* Copyright (C) 2005 Junio C Hamano * Copyright (C) 2010 Google Inc. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diff.h" #include "diffcore.h"
diffcore-rename.c +1 -0
@@ -4,6 +4,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h"
diffcore-rotate.c +3 -0
@@ -2,6 +2,9 @@* Copyright (C) 2021, Google LLC. * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
dir.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
entry.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-store-ll.h"
ewah/ewah_bitmap.c +3 -0
@@ -16,6 +16,9 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h"
ewah/ewah_io.c +3 -0
@@ -16,6 +16,9 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "ewok.h" #include "strbuf.h"
ewah/ewah_rlw.c +3 -0
@@ -16,6 +16,9 @@* You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "ewok.h" #include "ewok_rlw.h"
fetch-pack.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
fmt-merge-msg.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
fsmonitor.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
gettext.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2010 Ævar Arnfjörð Bjarmason */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "abspath.h" #include "environment.h"
git.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
gpg-interface.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
graph.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
grep.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "gettext.h"
help.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
hex.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hash.h"
http-backend.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
http-push.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
http-walker.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
http.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "git-curl-compat.h"
imap-send.c +1 -0
@@ -22,6 +22,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
json-writer.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "json-writer.h"
kwset.c +2 -0
@@ -32,6 +32,8 @@String Matching: An Aid to Bibliographic Search," CACM June 1975, Vol. 18, No. 6, which describes the failure function used below. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "kwset.h"
line-log.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diffcore.h" #include "line-range.h"
list-objects-filter-options.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
list-objects-filter.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
list-objects.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tag.h"
log-tree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit-reach.h"
ls-refs.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
mailinfo.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
mailmap.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
match-trees.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hex.h"
mem-pool.c +2 -0
@@ -2,6 +2,8 @@* Memory Pool implementation logic. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "mem-pool.h" #include "gettext.h"
merge-ll.c +1 -0
@@ -5,6 +5,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
merge-ort.c +1 -0
@@ -15,6 +15,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "merge-ort.h"
merge-recursive.c +1 -0
@@ -5,6 +5,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "merge-recursive.h"
merge.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
midx-write.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
midx.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
name-hash.c +1 -0
@@ -7,6 +7,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
notes-merge.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
notes.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
object-file-convert.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
object-file.c +1 -0
@@ -8,6 +8,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
object-name.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "object-name.h"
object.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
pack-bitmap-write.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
pack-bitmap.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
pack-check.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
packfile.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
parallel-checkout.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
patch-ids.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "diff.h" #include "commit.h"
path.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
pathspec.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
pkt-line.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "copy.h" #include "pkt-line.h"
preload-index.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pathspec.h"
pretty.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
progress.c +1 -0
@@ -10,6 +10,7 @@#define GIT_TEST_PROGRESS_ONLY #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pager.h"
pseudo-merge.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "pseudo-merge.h"
quote.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "path.h" #include "quote.h"
range-diff.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
reachable.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
read-cache.c +1 -0
@@ -5,6 +5,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "bulk-checkin.h"
ref-filter.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
reflog-walk.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
reflog.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
refs.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
refs/debug.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "hex.h" #include "refs-internal.h"
refs/files-backend.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "../abspath.h"
refs/iterator.c +2 -0
@@ -3,6 +3,8 @@* documentation about the design and use of reference iterators. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "refs.h" #include "refs/refs-internal.h"
refs/packed-backend.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "../git-compat-util.h" #include "../config.h"
refspec.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
reftable/system.h +2 -0
@@ -11,6 +11,8 @@ license that can be found in the LICENSE file or at/* This header glues the reftable library to the rest of Git */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "lockfile.h" #include "tempfile.h"
remote-curl.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "git-curl-compat.h"
remote.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
rerere.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
resolve-undo.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
revision.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
run-command.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "run-command.h"
scalar.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
send-pack.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
sequencer.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
serve.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "repository.h"
server-info.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
setup.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
shallow.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "hex.h"
sideband.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "color.h"
sparse-index.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
split-index.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
strbuf.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "hex-ll.h"
string-list.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "string-list.h"
strvec.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "strvec.h" #include "strbuf.h"
submodule-config.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
submodule.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
symlinks.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "setup.h"
t/helper/test-bloom.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "bloom.h"
t/helper/test-cache-tree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "gettext.h"
t/helper/test-config.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "config.h"
t/helper/test-csprng.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-drop-caches.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-dump-fsmonitor.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "read-cache-ll.h"
t/helper/test-dump-split-index.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h"
t/helper/test-dump-untracked-cache.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "dir.h"
t/helper/test-genrandom.c +2 -0
@@ -4,6 +4,8 @@* Copyright (C) 2007 by Nicolas Pitre, licensed under the GPL version 2. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-genzeros.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "git-compat-util.h"
t/helper/test-hash-speed.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "hash.h"
t/helper/test-mergesort.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "mem-pool.h" #include "mergesort.h"
t/helper/test-parse-options.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "parse-options.h" #include "strbuf.h"
t/helper/test-path-utils.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "abspath.h"
t/helper/test-reach.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
t/helper/test-ref-store.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "hex.h"
t/helper/test-revision-walking.c +1 -0
@@ -9,6 +9,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
t/helper/test-run-command.c +2 -0
@@ -8,6 +8,8 @@* published by the Free Software Foundation. */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "run-command.h" #include "strvec.h"
t/helper/test-string-list.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-tool.h" #include "strbuf.h" #include "string-list.h"
t/helper/test-tool.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "test-tool.h" #include "test-tool-utils.h"
t/helper/test-trace2.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "strvec.h"
t/unit-tests/lib-reftable.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "lib-reftable.h" #include "test-lib.h" #include "reftable/constants.h"
t/unit-tests/t-example-decorate.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-lib.h" #include "object.h"
t/unit-tests/t-prio-queue.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "prio-queue.h"
t/unit-tests/t-reftable-readwrite.c +2 -0
@@ -6,6 +6,8 @@ license that can be found in the LICENSE file or athttps://developers.google.com/open-source/licenses/bsd */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "lib-reftable.h" #include "reftable/basics.h"
t/unit-tests/t-reftable-stack.c +2 -0
@@ -6,6 +6,8 @@ license that can be found in the LICENSE file or athttps://developers.google.com/open-source/licenses/bsd */ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "lib-reftable.h" #include "reftable/merged.h"
t/unit-tests/t-trailer.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" #include "trailer.h"
t/unit-tests/test-lib.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "test-lib.h" enum result {
tag.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "environment.h"
tmp-objdir.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "tmp-objdir.h"
trace.c +1 -0
@@ -22,6 +22,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
trace2.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "repository.h"
trace2/tr2_sysenv.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "dir.h"
trace2/tr2_tgt_event.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "json-writer.h"
trace2/tr2_tgt_perf.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "config.h" #include "repository.h"
trailer.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
transport-helper.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "transport.h"
transport.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
tree-diff.c +1 -0
@@ -3,6 +3,7 @@*/ #define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "diff.h"
unix-socket.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "strbuf.h" #include "unix-socket.h"
unpack-trees.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
upload-pack.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
urlmatch.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "hex-ll.h"
usage.c +3 -0
@@ -3,6 +3,9 @@* * Copyright (C) Linus Torvalds, 2005 */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "gettext.h" #include "trace2.h"
userdiff.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
utf8.c +2 -0
@@ -1,3 +1,5 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "strbuf.h" #include "utf8.h"
version.c +1 -0
@@ -1,3 +1,4 @@ +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "version.h" #include "strbuf.h"
versioncmp.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "config.h"
worktree.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "abspath.h"
wrapper.c +3 -0
@@ -1,6 +1,9 @@/* * Various trivial helper wrappers around standard functions */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "abspath.h" #include "parse.h"
ws.c +3 -0
@@ -3,6 +3,9 @@* * Copyright (c) 2007 Junio C Hamano */ + +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "attr.h" #include "strbuf.h"
wt-status.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "advice.h"
xdiff-interface.c +1 -0
@@ -1,4 +1,5 @@#define USE_THE_REPOSITORY_VARIABLE +#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
xdiff/xdiffi.c +1 -0
@@ -19,6 +19,7 @@* Davide Libenzi <[email protected]> * */ +#define DISABLE_SIGN_COMPARE_WARNINGS #include "xinclude.h"
xdiff/xinclude.h +2 -0
@@ -23,6 +23,8 @@#if !defined(XINCLUDE_H )#define XINCLUDE_H +#define DISABLE_SIGN_COMPARE_WARNINGS +#include "git-compat-util.h" #include "xmacros.h" #include "xdiff.h"
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v4 5/16 config.mak.dev: drop `-Wno-sign-compare`
In reply to Patrick SteinhardtThere is no need anymore to disable -Wsign-compare now that all files that cause warnings have been marked accordingly. Drop the option.
--- config.mak.dev | 1 - 1 file changed, 1 deletion(-)
config.mak.dev +0 -1
@@ -53,7 +53,6 @@ ifeq ($(filter extra-all,$(DEVOPTS)),) # These are disabled because we have these all over the place. DEVELOPER_CFLAGS += -Wno-empty-body DEVELOPER_CFLAGS += -Wno-missing-field-initializers -DEVELOPER_CFLAGS += -Wno-sign-compare endif endif
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v4 6/16 diff.h: fix index used to loop through unsigned integer
In reply to Patrick SteinhardtThe struct diff_flags structure is essentially an array of flags, all of which have the same type. We can thus use sizeof() to iterate through all of the flags, which we do in diff_flags_or(). But while the statement returns an unsigned integer, we used a signed integer to iterate through the flags, which generates a warning.
Fix this by using size_t for the index instead.
--- builtin/am.c | 1 - builtin/diff-tree.c | 1 - builtin/merge-ours.c | 1 - builtin/pack-refs.c | 1 - builtin/range-diff.c | 1 - builtin/reflog.c | 1 - builtin/reset.c | 1 - builtin/revert.c | 1 - builtin/shortlog.c | 1 - diff-merges.c | 2 -- diff.h | 3 +-- diffcore-order.c | 2 -- diffcore-rotate.c | 2 -- list-objects-filter.c | 1 - patch-ids.c | 2 -- reachable.c | 1 - reflog-walk.c | 1 - t/helper/test-revision-walking.c | 1 - 18 files changed, 1 insertion(+), 23 deletions(-)
builtin/am.c +0 -1
@@ -5,7 +5,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "abspath.h"
builtin/diff-tree.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/merge-ours.c +0 -1
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "builtin.h"
builtin/pack-refs.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/range-diff.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "gettext.h"
builtin/reflog.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
builtin/reset.c +0 -1
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "advice.h"
builtin/revert.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "builtin.h"
builtin/shortlog.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "builtin.h" #include "config.h"
diff-merges.c +0 -2
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "diff-merges.h"
diff.h +1 -2
@@ -205,9 +205,8 @@ static inline void diff_flags_or(struct diff_flags *a, {char *tmp_a = (char *)a;const char *tmp_b = (const char *)b; -int i; -for (i =0 ; i <sizeof (struct diff_flags ); i++) +for (size_t i =0 ; i <sizeof (struct diff_flags ); i++) tmp_a[i] |= tmp_b[i]; }
diffcore-order.c +0 -2
@@ -2,8 +2,6 @@* Copyright (C) 2005 Junio C Hamano */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
diffcore-rotate.c +0 -2
@@ -3,8 +3,6 @@* Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano */ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "gettext.h" #include "diff.h"
list-objects-filter.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "dir.h"
patch-ids.c +0 -2
@@ -1,5 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS -#include "git-compat-util.h" #include "diff.h" #include "commit.h"
reachable.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "gettext.h"
reflog-walk.c +0 -1
@@ -1,5 +1,4 @@#define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "commit.h"
t/helper/test-revision-walking.c +0 -1
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "test-tool.h" #include "commit.h"
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v4 7/16 csum-file: fix -Wsign-compare warning on 32-bit platform
In reply to Patrick SteinhardtFrom: Junio C Hamano <[email protected]>
On 32-bit platforms, ssize_t may be "int" while size_t may be "unsigned int". At times we compare the number of bytes we read stored in a ssize_t variable with "unsigned int", but that is done after we check that we did not get an error return (which is negative---and that is the whole reason why we used ssize_t and not size_t), so these comparisons are safe.
But compilers may not realize that. Cast these to size_t to work around the false positives. On platforms with size_t/ssize_t wider than a normal int, this won't be an issue.
--- csum-file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
csum-file.c +1 -2
@@ -9,7 +9,6 @@*/ #define USE_THE_REPOSITORY_VARIABLE -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "progress.h"
@@ -24,7 +23,7 @@ static void verify_buffer_or_die(struct hashfile *f,if (ret <0 )die_errno ("%s: sha1 file read error" , f->name); -if (ret != count) +if ((size_t )ret != count)die ("%s: sha1 file truncated" , f->name);if (memcmp (buf, f->check_buffer, count))die ("sha1 file '%s' validation error" , f->name);
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
PATCH v4 8/16 pkt-line: fix -Wsign-compare warning on 32 bit platform
In reply to Patrick SteinhardtSimilar to the preceding commit, we get a warning in get_packet_data() on 32 bit platforms due to our lenient use of ssize_t. This function is kind of curious though: we accept an unsigned size of bytes to read, then store the actual number of bytes read in an ssize_t and return it as an int. This is a whole lot of integer conversions, and in theory these can cause us to overflow when the passed-in size is larger than ssize_t, which on 32 bit platforms is implemented as an int.
None of the callers of that function even care about the number of bytes we have read, so returning that number is moot anyway. Refactor the function such that it only returns an error code, which plugs the potential overflow. While at it, convert the passed-in size parameter to be of type size_t.
--- pkt-line.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
pkt-line.c +11 -9
@@ -340,30 +340,32 @@ int write_packetized_from_buf_no_flush_count(const char *src_in, size_t len, }static int get_packet_data (int fd,char **src_buf,size_t *src_size, -void *dst,unsigned size,int options) +void *dst,size_t size,int options) { -ssize_t ret; +size_t bytes_read;if (fd >=0 && src_buf && *src_buf)BUG ("multiple sources given to packet_read" );/* Read up to "size" bytes from our source, whatever it is. */ if (src_buf && *src_buf) { - ret = size < *src_size ? size : *src_size; -memcpy (dst, *src_buf, ret); - *src_buf += ret; - *src_size -= ret; + bytes_read = size < *src_size ? size : *src_size; +memcpy (dst, *src_buf, bytes_read); + *src_buf += bytes_read; + *src_size -= bytes_read; }else { - ret =read_in_full (fd, dst, size); +ssize_t ret =read_in_full (fd, dst, size);if (ret <0 ) {if (options &PACKET_READ_GENTLE_ON_READ_ERROR )return error_errno (_ ("read error" ));die_errno (_ ("read error" )); } + + bytes_read = (size_t ) ret; }/* And complain if we didn't get enough bytes to satisfy the read. */ -if (ret != size) { +if (bytes_read != size) {if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ;
@@ -372,7 +374,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size,die (_ ("the remote end hung up unexpectedly" )); } -return ret; +return 0 ; }int packet_length (const char lenbuf_hex[4 ],size_t size)
Signature · 1 line
2.47.0.366.g5daf58cba8.dirty
Re: [PATCH v4 08/16] pkt-line: fix -Wsign-compare warning on 32 bit platform
Quoted 8 lines · Patrick Steinhardt
Similar to the preceding commit, we get a warning in
get_packet_data()on 32 bit platforms due to our lenient use ofssize_t. This function is kind of curious though: we accept anunsigned sizeof bytes to read, then store the actual number of bytes read in anssize_tand return it as anint. This is a whole lot of integer conversions, and in theory these can cause us to overflow when the passed-in size is larger thanssize_t, which on 32 bit platforms is implemented as anint.
I think part of the reason this code is so lenient is that we know that pktline lengths will always fit into a 16-bit integer anyway. But I like that we can (after your patch) look at this function in isolation and immediately see there are no integer problems.
Quoted 5 lines
None of the callers of that function even care about the number of bytes we have read, so returning that number is moot anyway. Refactor the function such that it only returns an error code, which plugs the potential overflow. While at it, convert the passed-in size parameter to be of type
size_t.
This seems like a good approach to me. Whenever I think "but no callers do X", I always try to double-check: "might new callers want to do X"? And in this case, I think the answer is "no". They are asking to read a whole packet, and it is an error if we don't come up with whole thing. Showing the partial garbage we did get is unlikely outside of debug tracing (and in that case we'd probably put the tracing inside this function anyway).
Quoted 2 lines
pkt-line.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
The patch itself looks good.
-Peff
Re: [PATCH v4 08/16] pkt-line: fix -Wsign-compare warning on 32 bit platform
Quoted 3 lines · Jeff King
... Whenever I think "but no callers
do X", I always try to double-check: "might new callers want to do X"? And in this case, I think the answer is "no".
A very good piece of advice for those who are watching from sidelines. I agree that a return value that tries to tell more than "yup, I read everything as instructed" would not help in this case.
Quoted 12 lines
They are asking to read a
whole packet, and it is an error if we don't come up with whole thing. Showing the partial garbage we did get is unlikely outside of debug tracing (and in that case we'd probably put the tracing inside this function anyway).Quoted 2 lines
pkt-line.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)The patch itself looks good.
-Peff