diff --git a/compiler/semantics.cpp b/compiler/semantics.cpp index 732d7927..45ee793b 100644 --- a/compiler/semantics.cpp +++ b/compiler/semantics.cpp @@ -2876,6 +2876,10 @@ bool Semantics::CheckFunctionDeclImpl(FunctionDecl* info) { if (info->as()) maybe_used_.emplace_back(info); + // We never warn about unused stock functions. + if (info->is_stock()) + maybe_used_.emplace_back(info); + auto fwd = info->prototype(); if (fwd && fwd->deprecate() && !info->is_stock()) report(info->pos(), 234) << info->name() << fwd->deprecate(); diff --git a/tests/compile-only/ok-static-used-by-stock.inc b/tests/compile-only/ok-static-used-by-stock.inc new file mode 100644 index 00000000..32fd7c52 --- /dev/null +++ b/tests/compile-only/ok-static-used-by-stock.inc @@ -0,0 +1,7 @@ +static void SomeHelperFunction() +{} + +stock void HelpMe() +{ + SomeHelperFunction(); +} diff --git a/tests/compile-only/ok-static-used-by-stock.sp b/tests/compile-only/ok-static-used-by-stock.sp new file mode 100644 index 00000000..755df5c8 --- /dev/null +++ b/tests/compile-only/ok-static-used-by-stock.sp @@ -0,0 +1,5 @@ +// warnings_are_errors: true +#include "ok-static-used-by-stock.inc" + +public void main() +{}