The only way to add new vendor-specific pragmas is by modifying the front-end sources.
Proposed:
/**
* Checks whether the target/compiler supports the given pragma.
* Params:
* ident = name of the pragma
* args = arguments to pass to pragma
* statement = true if analysing a PragmaStatement.
*/
bool isPragmaSupported(Identifier ident, Expressions* args, bool statement)
{
// Implemented in Target::isPragmaSupported().
return false;
}
Example usage:
In dsymbolsem.d / statementsem.d:
else if (Target.isPragmaSupported(pd.ident, pd.args, false))
{
// Handled by backend.
}
else if (global.params.ignoreUnsupportedPragmas)
{
// Ignored on command-line.
}
else
pd.error("unrecognized pragma %s", pd.ident.toChars());
Comment #1 by robert.schadek — 2024-12-13T18:59:46Z