Skip to content

Commit 4e0d7a8

Browse files
Ramsay Jonesgitster
authored andcommitted
msvc: Fix some "expr evaluates to function" compiler warnings
In particular, the following warning is issued while compiling notes.c: notes.c(927) : warning C4550: expression evaluates to a \ function which is missing an argument list along with identical warnings on lines 928, 1016 and 1017. In order to suppress the warning, we change the definition of combine_notes_fn, so that the symbol type is an (explicit) "pointer to function ...". As a result, several other declarations need some minor fix-up to take account of the new typedef. Signed-off-by: Ramsay Jones <[email protected]> Acked-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a4c2454 commit 4e0d7a8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

builtin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ struct notes_rewrite_cfg {
2626
struct notes_tree **trees;
2727
const char *cmd;
2828
int enabled;
29-
combine_notes_fn *combine;
29+
combine_notes_fn combine;
3030
struct string_list *refs;
3131
int refs_from_env;
3232
int mode_from_env;
3333
};
3434

35-
combine_notes_fn *parse_combine_notes_fn(const char *v);
35+
combine_notes_fn parse_combine_notes_fn(const char *v);
3636
struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
3737
int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
3838
const unsigned char *from_obj, const unsigned char *to_obj);

builtin/notes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ int commit_notes(struct notes_tree *t, const char *msg)
313313
return 0;
314314
}
315315

316-
combine_notes_fn *parse_combine_notes_fn(const char *v)
316+
combine_notes_fn parse_combine_notes_fn(const char *v)
317317
{
318318
if (!strcasecmp(v, "overwrite"))
319319
return combine_notes_overwrite;

notes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* combine_notes_concatenate(), which appends the contents of the new note to
1919
* the contents of the existing note.
2020
*/
21-
typedef int combine_notes_fn(unsigned char *cur_sha1, const unsigned char *new_sha1);
21+
typedef int (*combine_notes_fn)(unsigned char *cur_sha1, const unsigned char *new_sha1);
2222

2323
/* Common notes combinators */
2424
int combine_notes_concatenate(unsigned char *cur_sha1, const unsigned char *new_sha1);
@@ -38,7 +38,7 @@ extern struct notes_tree {
3838
struct int_node *root;
3939
struct non_note *first_non_note, *prev_non_note;
4040
char *ref;
41-
combine_notes_fn *combine_notes;
41+
combine_notes_fn combine_notes;
4242
int initialized;
4343
int dirty;
4444
} default_notes_tree;

0 commit comments

Comments
 (0)