Skip to content

Commit 6e598e2

Browse files
deploy: ed67311
1 parent 2ed9080 commit 6e598e2

File tree

196 files changed

+596
-426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+596
-426
lines changed

404.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta charset="UTF-8">
55
<meta name="generator" content="Docusaurus v3.6.3">
66
<title data-rh="true">Page Not Found | ELP</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://whatsapp.github.io/erlang-language-platform/404.html/"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docusaurus_tag" content="default"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docsearch:docusaurus_tag" content="default"><meta data-rh="true" property="og:title" content="Page Not Found | ELP"><link data-rh="true" rel="icon" href="/erlang-language-platform/img/elp_icon_color.svg"><link data-rh="true" rel="canonical" href="https://whatsapp.github.io/erlang-language-platform/404.html/"><link data-rh="true" rel="alternate" href="https://whatsapp.github.io/erlang-language-platform/404.html/" hreflang="en"><link data-rh="true" rel="alternate" href="https://whatsapp.github.io/erlang-language-platform/404.html/" hreflang="x-default"><link rel="stylesheet" href="/erlang-language-platform/assets/css/styles.94ca9faf.css">
7-
<script src="/erlang-language-platform/assets/js/runtime~main.d5c92cba.js" defer="defer"></script>
8-
<script src="/erlang-language-platform/assets/js/main.5af44b4b.js" defer="defer"></script>
7+
<script src="/erlang-language-platform/assets/js/runtime~main.c35cfb82.js" defer="defer"></script>
8+
<script src="/erlang-language-platform/assets/js/main.48eff399.js" defer="defer"></script>
99
</head>
1010
<body class="navigation-with-keyboard">
1111
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script>

_src/erlang-error-index/w/W0057.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
sidebar_position: 57
3+
---
4+
5+
# W0057 - Undefined macro
6+
7+
## Error
8+
9+
```erlang
10+
-module(example).
11+
12+
foo() ->
13+
?UNDEFINED_MACRO.
14+
%% ^^^^^^^^^^^^^^^^ error: W0057: undefined macro 'UNDEFINED_MACRO'
15+
16+
bar(X) ->
17+
?UNDEFINED_WITH_ARGS(X, 42).
18+
%% ^^^^^^^^^^^^^^^^^^^^ error: W0057: undefined macro 'UNDEFINED_WITH_ARGS/2'
19+
```
20+
21+
This diagnostic is triggered when a macro usage cannot be resolved in ELP native
22+
diagnostic processing. The macro is referenced in the code but has not been defined
23+
in the current file or any included header files.
24+
25+
**Important:** This diagnostic corresponds to Erlang service diagnostics
26+
**E1507** (for macros without arguments) and **E1508** (for macros with
27+
arguments). W0057 only appears when the corresponding Erlang service diagnostic
28+
does not appear. If you see W0057 in a Buck project, it is likely a sign that
29+
the project is not defined properly in your TARGETS/BUCK file.
30+
31+
## Common Causes
32+
33+
1. **Missing macro definition**: The macro has not been defined with
34+
`-define()`.
35+
2. **Missing include file**: The macro is defined in a header file that has not
36+
been included.
37+
3. **Typo in macro name**: The macro name is misspelled.
38+
4. **Conditional compilation**: The macro is defined within a conditional block
39+
(e.g., `-ifdef()`) that is not active.
40+
41+
## Fix
42+
43+
### Define the macro
44+
45+
If the macro is not defined anywhere, add a `-define()` directive:
46+
47+
```erlang
48+
-module(example).
49+
50+
-define(UNDEFINED_MACRO, 42).
51+
-define(UNDEFINED_WITH_ARGS(X, Y), X + Y).
52+
53+
foo() ->
54+
?UNDEFINED_MACRO.
55+
56+
bar(X) ->
57+
?UNDEFINED_WITH_ARGS(X, 42).
58+
```
59+
60+
### Include the header file
61+
62+
If the macro is defined in a header file, add the appropriate `-include()` or
63+
`-include_lib()` directive:
64+
65+
```erlang
66+
-module(example).
67+
68+
-include("macros.hrl").
69+
70+
foo() ->
71+
?UNDEFINED_MACRO.
72+
```
73+
74+
### Fix typos
75+
76+
If the macro name is misspelled, correct it to match the definition:
77+
78+
```erlang
79+
-module(example).
80+
81+
-define(DEFINED_MACRO, 42).
82+
83+
foo() ->
84+
?DEFINED_MACRO. % Fixed typo
85+
```
86+
87+
## Relationship to Erlang Service Diagnostics
88+
89+
W0057 is filtered out when the Erlang service reports the corresponding
90+
diagnostics:
91+
92+
- **E1507**: undefined macro (without arguments)
93+
- **E1508**: undefined macro (with arguments)
94+
95+
When both diagnostics detect the same issue, only the Erlang service diagnostic
96+
will be shown to avoid duplication.
97+
98+
## Buck Project Configuration
99+
100+
If you see W0057 in a Buck project, this typically indicates that your TARGETS
101+
file is not properly configured. The Erlang service relies on Buck to understand
102+
the project structure, dependencies, and include paths. Check that:
103+
104+
- All application dependencies are declared in the `deps` attribute
105+
- Include paths are properly configured
106+
- The macro definition is in an accessible dependency

assets/js/19ef2ffb.3d138cdb.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/27b30b7f.6cf2aa33.js renamed to assets/js/27b30b7f.83a314d9.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dca304ba.8c20e279.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)