Peter N Lewis wrote:
: - if (co->pascal_dialect & C_E_O_M_PASCAL) : + if (co->pascal_dialect & C_E_O_PASCAL) : build_predef_call (p_CaseNoMatchError, NULL_TREE);
Peter N. Lewis added Mac Pascal here in his original patch for MP dialect support (2003-03-31). Could you please make sure which one is correct?
I'm no sure what the check is.
As far as I'm aware, no version of Mac Pascals has required an "otherwise" section for the case statement, and different Pascals have treated the absence as either a noop or a runtime error, sometimes depending on compiler flags (and in THINK Pascal's case, depending on whether Macsbug is installed (noop) or not (runtime error, effectively a crash) (I actually hacked my THINK Pascal to cause it to run time error all the time so at least you could detect the issue on a Mac with Macsbug installed) (Macsbug is a pre-Mac OS X global low level debugger that developers tended to installed to debug crashes).
Personally, I always use "otherwise Assert(false)" on all my cases, but that has nothing to do with how the flag should behave.
This basically does the same as the flag (though with a slightly different message).
IMHO, if not all versions/settings of MP make it an error, `gpc --mac-pascal' shouldn't either, so I agree with Adriaan's change. Otherwise (no pun intended ;-), we might have to add more detailed switches. I think a sub-version MP switch would be overkill for this issue by itself. However, I wouldn't mind a feature switch if deemed necessary (naming suggestions please, if you do).
Just to be sure, this switch would cause a *runtime* error if a case doesn't match any variant. It's not about compile-time errors or warnings.
Frank