Skip to content

Commit 1456b14

Browse files
committed
Add test cases related to issue #4365
Signed-off-by: Kyle Cripps <[email protected]>
1 parent 9ca48e2 commit 1456b14

21 files changed

+541
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Ensure that errors cannot be demoted to info messages.
2+
@command_line("--Winfo=type-error")
3+
parser p() {
4+
state accept {
5+
transition reject;
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Ensure that errors cannot be demoted to warnings.
2+
@command_line("--Wwarn=type-error")
3+
parser p() {
4+
state accept {
5+
transition reject;
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Ensure that errors cannot be disabled.
2+
@command_line("--Wdisable=type-error")
3+
parser p() {
4+
state accept {
5+
transition reject;
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@command_line("--Winfo=type-error") parser p() {
2+
}
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[--Werror=invalid] error: Error type-error cannot be demoted.
2+
(from pragmas): Compile a P4 program
3+
--help Print this help message
4+
--version Print compiler version
5+
-I path Specify include path (passed to preprocessor)
6+
-D arg=value Define macro (passed to preprocessor)
7+
-U arg Undefine macro (passed to preprocessor)
8+
-E Preprocess only, do not compile (prints program on stdout)
9+
-M Output `make` dependency rule only (passed to preprocessor)
10+
-MD Output `make` dependency rule to file as side effect (passed to preprocessor)
11+
-MF file With -M, specify output file for dependencies (passed to preprocessor)
12+
-MG with -M, suppress errors for missing headers (passed to preprocessor)
13+
-MP with -M, add phony target for each dependency (passed to preprocessor)
14+
-MT target With -M, override target of the output rule (passed to preprocessor)
15+
-MQ target Like -Mt, override target but quote special characters (passed to preprocessor)
16+
--std {p4-14|p4-16} Specify language version to compile.
17+
--nocpp Skip preprocess, assume input file is already preprocessed.
18+
--disable-annotations[=annotations] Specify a (comma separated) list of annotations that should be ignored by
19+
the compiler. A warning will be printed that the annotation is ignored
20+
--Wdisable[=diagnostic] Disable a compiler diagnostic, or disable all warnings if no diagnostic is specified.
21+
--Winfo[=diagnostic] Report an info message for a compiler diagnostic.
22+
--Wwarn[=diagnostic] Report a warning for a compiler diagnostic, or treat all info messages as warnings if no diagnostic is specified.
23+
--Werror[=diagnostic] Report an error for a compiler diagnostic, or treat all warnings as errors if no diagnostic is specified.
24+
--maxErrorCount errorCount Set the maximum number of errors to display before failing.
25+
-T loglevel [Compiler debugging] Adjust logging level per file (see below)
26+
-v [Compiler debugging] Increase verbosity level (can be repeated)
27+
--top4 pass1[,pass2] [Compiler debugging] Dump the P4 representation after
28+
passes whose name contains one of `passX' regex substrings. Matching is case-insensitive.
29+
When '-v' is used this will include the compiler IR.
30+
--dump folder [Compiler debugging] Folder where P4 programs are dumped
31+
--parser-inline-opt Enable optimization of inlining of callee parsers (subparsers).
32+
The optimization is disabled by default.
33+
When the optimization is disabled, for each invocation of the subparser
34+
all states of the subparser are inlined, which means that the subparser
35+
might be inlined multiple times even if it is the same instance
36+
which is invoked multiple times.
37+
When the optimization is enabled, compiler tries to identify the cases,
38+
when it can inline the subparser's states only once for multiple
39+
invocations of the same subparser instance.
40+
--doNotEmitIncludes [Compiler debugging] If true do not generate #include statements
41+
--excludeFrontendPasses pass1[,pass2] Exclude passes from frontend passes whose name is equal
42+
to one of `passX' strings.
43+
--listFrontendPasses List exact names of all frontend passes
44+
--excludeMidendPasses pass1[,pass2] Exclude passes from midend passes whose name is equal
45+
to one of `passX' strings.
46+
--toJSON file Dump the compiler IR after the midend as JSON in the specified file.
47+
--ndebug Compile program in non-debug mode.
48+
--testJson [Compiler debugging] Dump and undump the IR
49+
--pp file Pretty-print the program in the specified file.
50+
--p4runtime-file file Write a P4Runtime control plane API description to the specified file.
51+
[Deprecated; use '--p4runtime-files' instead].
52+
--p4runtime-entries-file file Write static table entries as a P4Runtime WriteRequest messageto the specified file.
53+
[Deprecated; use '--p4runtime-entries-files' instead].
54+
--p4runtime-files filelist Write the P4Runtime control plane API description to the specified
55+
files (comma-separated list). The format is inferred from the file
56+
suffix: .txt, .json, .bin
57+
--p4runtime-entries-files files Write static table entries as a P4Runtime WriteRequest message
58+
to the specified files (comma-separated list); the file format is
59+
inferred from the suffix. Legal suffixes are .json, .txt and .bin
60+
--p4runtime-format {binary,json,text} Choose output format for the P4Runtime API description (default is binary).
61+
[Deprecated; use '--p4runtime-files' instead].
62+
--target target Compile for the specified target device.
63+
--arch arch Compile for the specified architecture.
64+
--loopsUnroll Unrolling all parser's loops
65+
-O Optimization level
66+
--listMidendPasses [p4test] Lists exact name of all midend passes.
67+
--parse-only only parse the P4 input, without any further processing
68+
--validate Validate the P4 input, running just the front-end
69+
--fromJSON file read previously dumped json instead of P4 source code
70+
--turn-off-logn Turn off LOGN() statements in the compiler.
71+
Use '@__debug' annotation to enable LOGN on the annotated P4 object within the source code.
72+
--preferSwitch use passes that use general switch instead of action_run
73+
Additional usage instructions:
74+
loglevel format is: "sourceFile:level,...,sourceFile:level"
75+
where 'sourceFile' is a compiler source file and 'level' is the verbosity level for LOG messages in that file
76+
issue4365_no_demote_error_to_info.p4(4): [--Werror=invalid] error: Invalid parser state: accept should not be implemented, it is built-in
77+
state accept {
78+
^^^^^^
79+
issue4365_no_demote_error_to_info.p4(3): [--Werror=invalid] error: Parser p has no 'start' state
80+
parser p() {
81+
^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@command_line("--Wwarn=type-error") parser p() {
2+
}
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[--Werror=invalid] error: Error type-error cannot be demoted.
2+
(from pragmas): Compile a P4 program
3+
--help Print this help message
4+
--version Print compiler version
5+
-I path Specify include path (passed to preprocessor)
6+
-D arg=value Define macro (passed to preprocessor)
7+
-U arg Undefine macro (passed to preprocessor)
8+
-E Preprocess only, do not compile (prints program on stdout)
9+
-M Output `make` dependency rule only (passed to preprocessor)
10+
-MD Output `make` dependency rule to file as side effect (passed to preprocessor)
11+
-MF file With -M, specify output file for dependencies (passed to preprocessor)
12+
-MG with -M, suppress errors for missing headers (passed to preprocessor)
13+
-MP with -M, add phony target for each dependency (passed to preprocessor)
14+
-MT target With -M, override target of the output rule (passed to preprocessor)
15+
-MQ target Like -Mt, override target but quote special characters (passed to preprocessor)
16+
--std {p4-14|p4-16} Specify language version to compile.
17+
--nocpp Skip preprocess, assume input file is already preprocessed.
18+
--disable-annotations[=annotations] Specify a (comma separated) list of annotations that should be ignored by
19+
the compiler. A warning will be printed that the annotation is ignored
20+
--Wdisable[=diagnostic] Disable a compiler diagnostic, or disable all warnings if no diagnostic is specified.
21+
--Winfo[=diagnostic] Report an info message for a compiler diagnostic.
22+
--Wwarn[=diagnostic] Report a warning for a compiler diagnostic, or treat all info messages as warnings if no diagnostic is specified.
23+
--Werror[=diagnostic] Report an error for a compiler diagnostic, or treat all warnings as errors if no diagnostic is specified.
24+
--maxErrorCount errorCount Set the maximum number of errors to display before failing.
25+
-T loglevel [Compiler debugging] Adjust logging level per file (see below)
26+
-v [Compiler debugging] Increase verbosity level (can be repeated)
27+
--top4 pass1[,pass2] [Compiler debugging] Dump the P4 representation after
28+
passes whose name contains one of `passX' regex substrings. Matching is case-insensitive.
29+
When '-v' is used this will include the compiler IR.
30+
--dump folder [Compiler debugging] Folder where P4 programs are dumped
31+
--parser-inline-opt Enable optimization of inlining of callee parsers (subparsers).
32+
The optimization is disabled by default.
33+
When the optimization is disabled, for each invocation of the subparser
34+
all states of the subparser are inlined, which means that the subparser
35+
might be inlined multiple times even if it is the same instance
36+
which is invoked multiple times.
37+
When the optimization is enabled, compiler tries to identify the cases,
38+
when it can inline the subparser's states only once for multiple
39+
invocations of the same subparser instance.
40+
--doNotEmitIncludes [Compiler debugging] If true do not generate #include statements
41+
--excludeFrontendPasses pass1[,pass2] Exclude passes from frontend passes whose name is equal
42+
to one of `passX' strings.
43+
--listFrontendPasses List exact names of all frontend passes
44+
--excludeMidendPasses pass1[,pass2] Exclude passes from midend passes whose name is equal
45+
to one of `passX' strings.
46+
--toJSON file Dump the compiler IR after the midend as JSON in the specified file.
47+
--ndebug Compile program in non-debug mode.
48+
--testJson [Compiler debugging] Dump and undump the IR
49+
--pp file Pretty-print the program in the specified file.
50+
--p4runtime-file file Write a P4Runtime control plane API description to the specified file.
51+
[Deprecated; use '--p4runtime-files' instead].
52+
--p4runtime-entries-file file Write static table entries as a P4Runtime WriteRequest messageto the specified file.
53+
[Deprecated; use '--p4runtime-entries-files' instead].
54+
--p4runtime-files filelist Write the P4Runtime control plane API description to the specified
55+
files (comma-separated list). The format is inferred from the file
56+
suffix: .txt, .json, .bin
57+
--p4runtime-entries-files files Write static table entries as a P4Runtime WriteRequest message
58+
to the specified files (comma-separated list); the file format is
59+
inferred from the suffix. Legal suffixes are .json, .txt and .bin
60+
--p4runtime-format {binary,json,text} Choose output format for the P4Runtime API description (default is binary).
61+
[Deprecated; use '--p4runtime-files' instead].
62+
--target target Compile for the specified target device.
63+
--arch arch Compile for the specified architecture.
64+
--loopsUnroll Unrolling all parser's loops
65+
-O Optimization level
66+
--listMidendPasses [p4test] Lists exact name of all midend passes.
67+
--parse-only only parse the P4 input, without any further processing
68+
--validate Validate the P4 input, running just the front-end
69+
--fromJSON file read previously dumped json instead of P4 source code
70+
--turn-off-logn Turn off LOGN() statements in the compiler.
71+
Use '@__debug' annotation to enable LOGN on the annotated P4 object within the source code.
72+
--preferSwitch use passes that use general switch instead of action_run
73+
Additional usage instructions:
74+
loglevel format is: "sourceFile:level,...,sourceFile:level"
75+
where 'sourceFile' is a compiler source file and 'level' is the verbosity level for LOG messages in that file
76+
issue4365_no_demote_error_to_warning.p4(4): [--Werror=invalid] error: Invalid parser state: accept should not be implemented, it is built-in
77+
state accept {
78+
^^^^^^
79+
issue4365_no_demote_error_to_warning.p4(3): [--Werror=invalid] error: Parser p has no 'start' state
80+
parser p() {
81+
^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@command_line("--Wdisable=type-error") parser p() {
2+
}
3+

0 commit comments

Comments
 (0)