Skip to content

Commit

Permalink
[warnings] use -w instead of defines (#12013)
Browse files Browse the repository at this point in the history
* Always check var shadowing, disable associated warning by default

* Deprecate some warnings related defines
  • Loading branch information
kLabz committed Mar 6, 2025
1 parent bd32fad commit 531da9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src-json/define.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,8 @@
{
"name": "NoDeprecationWarnings",
"define": "no-deprecation-warnings",
"doc": "Do not warn if fields annotated with `@:deprecated` are used."
"doc": "Do not warn if fields annotated with `@:deprecated` are used.",
"deprecated": "Use -w to configure warnings. See https://haxe.org/manual/cr-warnings.html for more information."
},
{
"name": "NoFlashOverride",
Expand Down Expand Up @@ -758,7 +759,8 @@
{
"name": "WarnVarShadowing",
"define": "warn-var-shadowing",
"doc": "Warn about shadowing variable declarations."
"doc": "Warn about shadowing variable declarations.",
"deprecated": "Use -w to configure warnings. See https://haxe.org/manual/cr-warnings.html for more information."
},
{
"name": "NoTre",
Expand Down
3 changes: 2 additions & 1 deletion src-json/warning.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
{
"name": "WVarShadow",
"doc": "A local variable hides another by using the same name",
"parent": "WTyper"
"parent": "WTyper",
"enabled": false
},
{
"name": "WExternWithExpr",
Expand Down
2 changes: 1 addition & 1 deletion src/context/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ let save_locals ctx =

let add_local ctx k n t p =
let v = alloc_var k n t p in
if Define.defined ctx.com.defines Define.WarnVarShadowing && n <> "_" then begin
if n <> "_" then begin
match k with
| VUser _ ->
begin try
Expand Down

0 comments on commit 531da9c

Please sign in to comment.