Foregoing Unused Label Warnings for Code Organization

Especially in the stackless model, there's a need for code to be able to be divided into independent sections where the variables in one section don't carry to another... also so that you can goto without crossing initializations.

Stylistically, I think this pattern looks quite nice:

void Some_Function(...) {

    /* top definitions available to all code */

  step_one: { ////////////////////////////////////////////////////////

    /* code can see top definitions */

} step_two: { ////////////////////////////////////////////////////////

    /* code can see top definitions, but not step one */

} step_three: { //////////////////////////////////////////////////////

    /* can see top definitions but not step one or two */

}}

It solves a lot of problems.

The only problem is, I don't always want to GOTO a step. Sometimes they just fall through. And the compiler has a "unused goto label" warning.

To get around it, I don't want to have to write:

void Some_Function(...) {

    /* top definitions available to all code */

    goto step_one;

  step_one: { ////////////////////////////////////////////////////////

    /* code can see top definitions */

   goto step_two;

} step_two: { ////////////////////////////////////////////////////////

    /* code can see top definitions, but not step one */

    goto step_three;

} step_three: { //////////////////////////////////////////////////////

    /* can see top definitions but not step one or two */

}}

I've tried to scam it, having wild ideas like building an automatic goto into a SECTION() macro:

#define SECTION(name)  goto name; name##:

void Some_Function(...) {

    /* top definitions available to all code */

  SECTION(step_one) { ///////////////////////////////////////////////

    /* code can see top definitions */

} SECTION(step_two) { ///////////////////////////////////////////////

    /* code can see top definitions, but not step one */

} SECTION(step_three) { /////////////////////////////////////////////

    /* can see top definitions but not step one or two */

}}

Clever though that may be, it does not work (you can't token paste a colon onto a symbol in a macro and produce a label). Also, it looks worse.

Ultimately I think being able to write the code like this is worth it. So I'm disabling the unused label warning.

It's not really that interesting a warning--considering that what you're really interested in is unreachable code. Who cares whether a goto label is explicitly gone to--or if code just falls through it--so long as it's reachable? And that's covered by other warnings.