You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defines some implementations to check build error in C/C++.
3
+
Defines some implementations to check build error in C/C++. Each of them can be loaded from `//lang/cc:defs.bzl`.
4
4
5
5
## `cc_build_error`
6
6
7
7
`cc_build_error` is a rule providing [`CcBuildErrorInfo`](#ccbuilderrorinfo).
8
8
9
9
In addition to the common rule attributes listed [here](https://bazel.build/reference/be/common-definitions#common-attributes), it can receive the following attributes (regarding the specific matcher, please refer to [its readme](../../matcher/README.md)):
10
10
11
-
| Attribute | Description | Type | Is this attribute required? | Other constraints |
| src | C/C++ source file to check build | label | Yes | Must be a single file having an extension for C/C++ |
15
-
| additional_linker_inputs | Pass these files to the linker command | list of labels | No (defaults to `[]`) ||
16
-
| copts | C/C++ compilation options | list of str | No (defaults to `[]`) ||
17
-
| deps | The list of CcInfo libraries to be linked in to the binary target. | list of label | No (defaults to `[]`) | Each list element must provide `CcInfo`|
18
-
| linkopts | C/C++ linking options | list of str | No (defaults to `[]`) ||
19
-
| local_defines | Pre-processor macro definitions | list of str | No (defaults to `[]`) ||
20
-
| compile_stderr | Matcher for the stderr message while compiling | specific matcher | No (defaults to no-op) ||
21
-
| compile_stdout | Matcher for the stdout message while compiling | specific matcher | No (defaults to no-op) ||
22
-
| link_stderr | Matcher for the stderr message while linking | specific matcher | No (defaults to no-op) ||
23
-
| link_stdout | Matcher for the stdout message while linking | specific matcher | No (defaults to no-op) ||
11
+
| Attribute | Description | Type | Is this attribute required? | Other constraints |
| src | C/C++ source file to check build | label or [an inline source](#inline_src)| Yes | Must be a single file having an extension for C/C++ |
15
+
| additional_linker_inputs | Pass these files to the linker command | list of labels | No (defaults to `[]`) ||
16
+
| copts | C/C++ compilation options | list of str | No (defaults to `[]`) ||
17
+
| deps | The list of CcInfo libraries to be linked in to the binary target. | list of label | No (defaults to `[]`) | Each list element must provide `CcInfo`|
18
+
| linkopts | C/C++ linking options | list of str | No (defaults to `[]`) ||
19
+
| local_defines | Pre-processor macro definitions | list of str | No (defaults to `[]`) ||
20
+
| compile_stderr | Matcher for the stderr message while compiling | specific matcher | No (defaults to no-op) ||
21
+
| compile_stdout | Matcher for the stdout message while compiling | specific matcher | No (defaults to no-op) ||
22
+
| link_stderr | Matcher for the stderr message while linking | specific matcher | No (defaults to no-op) ||
23
+
| link_stdout | Matcher for the stdout message while linking | specific matcher | No (defaults to no-op) ||
24
24
25
25
### `CcBuildErrorInfo`
26
26
@@ -29,3 +29,7 @@ In addition to the common rule attributes listed [here](https://bazel.build/refe
29
29
## `cc_build_error_test`
30
30
31
31
`cc_build_error_test` is a test rule used to verify that `cc_build_error` builds successfully. It accepts the same set of arguments as `cc_build_error`.
32
+
33
+
## `inline_src`
34
+
35
+
Using `inline_src`, you can provide source code as an inline string. The function `inline_src.c` generates a C source file, while `inline_src.cpp` generates a C++ source file. Both functions accept a string containing the source code as their argument.
Copy file name to clipboardExpand all lines: matcher/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Matcher
2
2
3
-
Defines a struct `matcher`.
3
+
Defines a struct `matcher`, which can be loaded from `//matcher:defs.bzl`.
4
4
5
5
`matcher` has some member functions each of which receives a pattern string as a positional string argument, and which returns its specific matcher. Each specific matcher can be used to specify the way of validating the build error message (stderr or stdout).
0 commit comments