@matheusbsbs / matheus-bagliano / commits / 4e0d7a8018
Fork 0

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 <ramsay@ramsay1.demon.co.uk> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Jun 23, 2010 at 20:40 UTC 4e0d7a80186c27f1a008dd10eaea6f25b0e1fe19
3 files changed +5 -5
builtin.h
+2 -2
@@ -26,13 +26,13 @@ struct notes_rewrite_cfg {
26 struct notes_tree **trees;
27 const char *cmd;
28 int enabled;
29 - combine_notes_fn *combine;
29 + combine_notes_fn combine;
30 struct string_list *refs;
31 int refs_from_env;
32 int mode_from_env;
33 };
34
35 -combine_notes_fn *parse_combine_notes_fn(const char *v);
35 +combine_notes_fn parse_combine_notes_fn(const char *v);
36 struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);
37 int copy_note_for_rewrite(struct notes_rewrite_cfg *c,
38 const unsigned char *from_obj, const unsigned char *to_obj);
builtin/notes.c
+1 -1
@@ -313,7 +313,7 @@ int commit_notes(struct notes_tree *t, const char *msg)
313 return 0;
314 }
315
316 -combine_notes_fn *parse_combine_notes_fn(const char *v)
316 +combine_notes_fn parse_combine_notes_fn(const char *v)
317 {
318 if (!strcasecmp(v, "overwrite"))
319 return combine_notes_overwrite;
notes.h
+2 -2
@@ -18,7 +18,7 @@
18 * combine_notes_concatenate(), which appends the contents of the new note to
19 * the contents of the existing note.
20 */
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);
22
23 /* Common notes combinators */
24 int combine_notes_concatenate(unsigned char *cur_sha1, const unsigned char *new_sha1);
@@ -38,7 +38,7 @@ extern struct notes_tree {
38 struct int_node *root;
39 struct non_note *first_non_note, *prev_non_note;
40 char *ref;
41 - combine_notes_fn *combine_notes;
41 + combine_notes_fn combine_notes;
42 int initialized;
43 int dirty;
44 } default_notes_tree;