[Issue 19110] New: [internal] Provide interface for implementing vendor-specific pragmas

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 22 18:44:16 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19110

          Issue ID: 19110
           Summary: [internal] Provide interface for implementing
                    vendor-specific pragmas
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

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());

--


More information about the Digitalmars-d-bugs mailing list