www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19110] New: [internal] Provide interface for implementing


          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 puremagic.com
          Reporter: ibuclaw gdcproject.org

The only way to add new vendor-specific pragmas is by modifying the front-end


 * 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.
    pd.error("unrecognized pragma %s", pd.ident.toChars());

Jul 22 2018