Skip to content

Commit

Permalink
Deduplicate errno values in errno2name()
Browse files Browse the repository at this point in the history
On Darwin, the EQFULL and ELAST error constants lead to the same errno
value (106), so we get a build error like this:

  src/errno_list.cc:228:14: error: duplicate case value '106'
        case 106: return "EQFULL";
             ^
  src/errno_list.cc:227:14: note: previous case defined here
        case 106: return "ELAST";
             ^

We can simply throw away the duplicate values, because all that
errno2name is used for is printing the current rules with the -p command
line argument.

Signed-off-by: aszlig <[email protected]>
  • Loading branch information
aszlig committed Jul 8, 2020
1 parent fb7b4d9 commit 5911036
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/generrno.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

out += 'const std::string errno2name(int num)\n{\n'
out += ' switch (num) {\n'
for number, name in errnos:
for number, name in dict(errnos).items():
out += ' case ' + str(number) + ': return "' + name + '";\n'
out += ' default: return "<unknown>";\n'
out += ' }\n'
Expand Down

0 comments on commit 5911036

Please sign in to comment.