]> granicus.if.org Git - graphviz/commitdiff
cgraph aagerror: squash -Wswitch-default warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 16 Oct 2022 03:59:03 +0000 (20:59 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 19 Oct 2022 14:44:37 +0000 (07:44 -0700)
Squashes:

  ../../lib/cgraph/scan.l: In function â€˜aagerror’:
  ../../lib/cgraph/scan.l:232:14: warning: switch missing default case
    [-Wswitch-default]
    232 |         else switch (YYSTATE) {
        |              ^~~~~~

This switch is adding more information to the error message based on which
lexing state we are in, of which four are defined: `INITIAL` (the built-in start
state), `comment`, `hstring`, and `qstring`. In the `INITIAL` state there is no
extra information to add.

lib/cgraph/scan.l

index ee8e60f0c7f1a4d5f66ab413052dd0e97645d147..8dfb23a9dbc76b5d19d0e3975de52f7dcb6f0fd2 100644 (file)
@@ -255,6 +255,8 @@ void aagerror(const char *str)
        case comment :
                agxbprint(&xb, " scanning a /*...*/ comment (missing '*/? longer than %d?)", YY_BUF_SIZE);
                break;
+       default: // nothing extra to note
+               break;
        }
        agxbputc (&xb, '\n');
        agerr(AGERR, "%s", agxbuse(&xb));