git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] Fix an enum assignment issue spotted by Sun Studio

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 21, 2011, 01:18 UTC
Message-ID
<1324430302-22441-2-git-send-email-avarab@gmail.com>
In-Reply-To
<1324430302-22441-1-git-send-email-avarab@gmail.com>

In builtin/fast-export.c we'd assign to variables of the tag_of_filtered_mode enum type with constants defined for the signed_tag_mode enum.

We'd get the intended value since both the value we were assigning with and the one we actually wanted had the same positional within their respective enums, but doing it this way makes no sense.

This issue was spotted by Sun Studio 12 Update 1:
    "builtin/fast-export.c", line 54: warning: enum type mismatch: op "=" (E_ENUM_TYPE_MISMATCH_OP)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/fast-export.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 9836e6b..08fed98 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -25,7 +25,7 @@ static const char *fast_export_usage[] = {
 
 static int progress;
 static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
-static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
+static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ERROR;
 static int fake_missing_tagger;
 static int use_done_feature;
 static int no_data;
@@ -51,7 +51,7 @@ static int parse_opt_tag_of_filtered_mode(const struct option *opt,
 					  const char *arg, int unset)
 {
 	if (unset || !strcmp(arg, "abort"))
-		tag_of_filtered_mode = ABORT;
+		tag_of_filtered_mode = ERROR;
 	else if (!strcmp(arg, "drop"))
 		tag_of_filtered_mode = DROP;
 	else if (!strcmp(arg, "rewrite"))
-- 
1.7.7.3
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 2 of 8 in “Eliminate warnings under Sun Studio”
  1. 0/4 Eliminate warnings under Sun StudioÆvar Arnfjörð Bjarmason, Dec 21, 2011
  2. 1/4 Fix an enum assignment issue spotted by Sun StudioÆvar Arnfjörð Bjarmason, Dec 21, 2011
  3. 2/4 Fix a bitwise negation assignment issue spotted by Sun StudioÆvar Arnfjörð Bjarmason, Dec 21, 2011
  4. 3/4 Appease Sun Studio by renaming "tmpfile"Ævar Arnfjörð Bjarmason, Dec 21, 2011
  5. 4/4 Suppress "statement not reached" warnings under Sun StudioÆvar Arnfjörð Bjarmason, Dec 21, 2011
  6. Junio C HamanoDec 21, 2011
  7. Ævar Arnfjörð BjarmasonDec 21, 2011
  8. Junio C HamanoDec 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.