weaken the rules for proc definition pragmas that have been forwarded

This commit is contained in:
Araq 2017-05-16 22:07:44 +02:00
commit ac3e7edfe4

View file

@ -1325,6 +1325,14 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
implicitPragmas(c, s, n, validPragmas) implicitPragmas(c, s, n, validPragmas)
else: else:
if n.sons[pragmasPos].kind != nkEmpty: if n.sons[pragmasPos].kind != nkEmpty:
pragma(c, s, n.sons[pragmasPos], validPragmas)
# To ease macro generation that produce forwarded .async procs we now
# allow a bit redudancy in the pragma declarations. The rule is
# a prototype's pragma list must be a superset of the current pragma
# list.
# XXX This needs more checks eventually, for example that external
# linking names do agree:
if proto.typ.callConv != s.typ.callConv or proto.typ.flags < s.typ.flags:
localError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProcX, localError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProcX,
"'" & proto.name.s & "' from " & $proto.info) "'" & proto.name.s & "' from " & $proto.info)
if sfForward notin proto.flags: if sfForward notin proto.flags: