added local pragma for consumer

This commit is contained in:
Martino Ferrari
2026-01-30 14:52:44 +01:00
parent 6fa67abcb4
commit a55c4b9c7c

View File

@@ -974,12 +974,21 @@ func (v *Validator) CheckINOUTOrdering() {
} }
if !consumed { if !consumed {
for _, prod := range producers { for _, prod := range producers {
v.Diagnostics = append(v.Diagnostics, Diagnostic{ locally_suppressed := false
Level: LevelWarning, for _, p := range prod.Pragmas {
Message: fmt.Sprintf("INOUT Signal '%s' (DS '%s') is produced in thread '%s' but never consumed in the same thread.", sigName, ds.RealName, thread.RealName), if strings.HasPrefix(p, "not_consumed:") || strings.HasPrefix(p, "ignore(not_consumed)") {
Position: v.getNodePosition(prod), locally_suppressed = true
File: v.getNodeFile(prod), break
}) }
}
if !locally_suppressed {
v.Diagnostics = append(v.Diagnostics, Diagnostic{
Level: LevelWarning,
Message: fmt.Sprintf("INOUT Signal '%s' (DS '%s') is produced in thread '%s' but never consumed in the same thread.", sigName, ds.RealName, thread.RealName),
Position: v.getNodePosition(prod),
File: v.getNodeFile(prod),
})
}
} }
} }
} }
@@ -1042,15 +1051,15 @@ func (v *Validator) processGAMSignalsForOrdering(gam *index.ProjectNode, contain
isProduced = true isProduced = true
} }
} }
locally_supressed := false locally_suppressed := false
for _, p := range sig.Pragmas { for _, p := range sig.Pragmas {
if strings.HasPrefix(p, "not_produced:") || strings.HasPrefix(p, "ignore(not_produced)") { if strings.HasPrefix(p, "not_produced:") || strings.HasPrefix(p, "ignore(not_produced)") {
locally_supressed = true locally_suppressed = true
break break
} }
} }
if !isProduced && !locally_supressed { if !isProduced && !locally_suppressed {
v.Diagnostics = append(v.Diagnostics, Diagnostic{ v.Diagnostics = append(v.Diagnostics, Diagnostic{
Level: LevelError, Level: LevelError,
Message: fmt.Sprintf("INOUT Signal '%s' (DS '%s') is consumed by GAM '%s' in thread '%s' (State '%s') before being produced by any previous GAM.", sigName, dsNode.RealName, gam.RealName, thread.RealName, state.RealName), Message: fmt.Sprintf("INOUT Signal '%s' (DS '%s') is consumed by GAM '%s' in thread '%s' (State '%s') before being produced by any previous GAM.", sigName, dsNode.RealName, gam.RealName, thread.RealName, state.RealName),