| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/no_prelude/cpp_diagnostics.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/no_prelude/cpp_diagnostics.carbon
- // --- one_error.h
- #error "error1"
- // --- fail_import_cpp_file_with_one_error.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_import_cpp_file_with_one_error.carbon:[[@LINE+9]]:1: error: 1 error and 0 warnings in 1 `Cpp` import:
- // CHECK:STDERR: In file included from fail_import_cpp_file_with_one_error.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./one_error.h:2:2: error: "error1"
- // CHECK:STDERR: 2 | #error "error1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseError]
- // CHECK:STDERR: import Cpp library "one_error.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "one_error.h";
- // --- multiple_errors.h
- #error "error1"
- #error "error2"
- // --- fail_import_cpp_file_with_multiple_errors.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+12]]:1: error: 2 errors and 0 warnings in 1 `Cpp` import:
- // CHECK:STDERR: In file included from fail_import_cpp_file_with_multiple_errors.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./multiple_errors.h:2:2: error: "error1"
- // CHECK:STDERR: 2 | #error "error1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors.h:3:2: error: "error2"
- // CHECK:STDERR: 3 | #error "error2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseError]
- // CHECK:STDERR: import Cpp library "multiple_errors.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "multiple_errors.h";
- // --- one_warning.h
- #warning "warning1"
- // --- import_cpp_file_with_one_warning.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: import_cpp_file_with_one_warning.carbon:[[@LINE+9]]:1: warning: 1 warning in `Cpp` 1 import:
- // CHECK:STDERR: In file included from import_cpp_file_with_one_warning.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1"
- // CHECK:STDERR: 2 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseWarning]
- // CHECK:STDERR: import Cpp library "one_warning.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "one_warning.h";
- // --- multiple_warnings.h
- #warning "warning1"
- #warning "warning2"
- #warning "warning3"
- // --- import_cpp_file_with_multiple_warnings.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+15]]:1: warning: 3 warnings in `Cpp` 1 import:
- // CHECK:STDERR: In file included from import_cpp_file_with_multiple_warnings.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1"
- // CHECK:STDERR: 2 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2"
- // CHECK:STDERR: 3 | #warning "warning2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3"
- // CHECK:STDERR: 4 | #warning "warning3"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseWarning]
- // CHECK:STDERR: import Cpp library "multiple_warnings.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "multiple_warnings.h";
- // --- one_error_and_one_warning.h
- #error "error1"
- #warning "warning1"
- // --- fail_import_cpp_file_with_one_error_and_one_warning.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+12]]:1: error: 1 error and 1 warning in 1 `Cpp` import:
- // CHECK:STDERR: In file included from fail_import_cpp_file_with_one_error_and_one_warning.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1"
- // CHECK:STDERR: 2 | #error "error1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1"
- // CHECK:STDERR: 3 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseError]
- // CHECK:STDERR: import Cpp library "one_error_and_one_warning.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "one_error_and_one_warning.h";
- // --- multiple_errors_and_multiple_warnings.h
- #error "error1"
- #error "error2"
- #warning "warning1"
- #warning "warning2"
- #warning "warning3"
- // --- fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon
- library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+21]]:1: error: 2 errors and 3 warnings in 1 `Cpp` import:
- // CHECK:STDERR: In file included from fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1"
- // CHECK:STDERR: 2 | #error "error1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2"
- // CHECK:STDERR: 3 | #error "error2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1"
- // CHECK:STDERR: 4 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2"
- // CHECK:STDERR: 5 | #warning "warning2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3"
- // CHECK:STDERR: 6 | #warning "warning3"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseError]
- // CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "multiple_errors_and_multiple_warnings.h";
- // --- import_multiple_cpp_files_with_warnings.carbon
- library "[[@TEST_NAME]]";
- import Cpp library "one_warning.h";
- // CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+19]]:1: warning: 4 warnings in `Cpp` 2 imports:
- // CHECK:STDERR: In file included from import_multiple_cpp_files_with_warnings.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1"
- // CHECK:STDERR: 2 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: In file included from import_multiple_cpp_files_with_warnings.carbon.generated.cpp_imports.h:2:
- // CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1"
- // CHECK:STDERR: 2 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2"
- // CHECK:STDERR: 3 | #warning "warning2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3"
- // CHECK:STDERR: 4 | #warning "warning3"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseWarning]
- // CHECK:STDERR: import Cpp library "multiple_warnings.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "multiple_warnings.h";
- // --- fail_import_multiple_cpp_files_with_warnings_and_errors.carbon
- library "[[@TEST_NAME]]";
- import Cpp library "one_error_and_one_warning.h";
- // CHECK:STDERR: fail_import_multiple_cpp_files_with_warnings_and_errors.carbon:[[@LINE+28]]:1: error: 3 errors and 4 warnings in 2 `Cpp` imports:
- // CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:1:
- // CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1"
- // CHECK:STDERR: 2 | #error "error1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1"
- // CHECK:STDERR: 3 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: In file included from fail_import_multiple_cpp_files_with_warnings_and_errors.carbon.generated.cpp_imports.h:2:
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1"
- // CHECK:STDERR: 2 | #error "error1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2"
- // CHECK:STDERR: 3 | #error "error2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1"
- // CHECK:STDERR: 4 | #warning "warning1"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2"
- // CHECK:STDERR: 5 | #warning "warning2"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3"
- // CHECK:STDERR: 6 | #warning "warning3"
- // CHECK:STDERR: | ^
- // CHECK:STDERR: [CppInteropParseError]
- // CHECK:STDERR: import Cpp library "multiple_errors_and_multiple_warnings.h";
- // CHECK:STDERR: ^~~~~~
- // CHECK:STDERR:
- import Cpp library "multiple_errors_and_multiple_warnings.h";
- // CHECK:STDOUT: --- fail_import_cpp_file_with_one_error.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_import_cpp_file_with_multiple_errors.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- import_cpp_file_with_one_warning.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- import_cpp_file_with_multiple_warnings.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_import_cpp_file_with_one_error_and_one_warning.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- import_multiple_cpp_files_with_warnings.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_import_multiple_cpp_files_with_warnings_and_errors.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [template] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
|