Debian Codegraph @

clang/test/Driver/ps5-sdk-root.c

raw
1 /// (Essentially identical to ps4-sdk-root.c except for the target.)
2
3 /// PS5 clang emits warnings when SDK headers (<SDKROOT>/target/include/) or
4 /// libraries (<SDKROOT>/target/lib/) are missing. If the the user takes control
5 /// of header search paths, the existence check for <SDKROOT>/target/include is
6 /// skipped.
7 ///
8 /// User control of header search is assumed if `--sysroot`, `-isysroot`,
9 /// `-nostdinc` or `-nostdlibinc` is supplied.
10 ///
11 /// Warnings are emitted if a specified `-isysroot` or `--sysroot` does not
12 /// exist.
13 ///
14 /// The default <SDKROOT> for both headers and libraries is taken from the
15 /// SCE_PROSPERO_SDK_DIR environment variable.
16 ///
17 /// In ThinLTO code generation mode (-fthinlto-index=) SDK files are not required
18 /// so all warnings are suppressed.
19
20 // RUN: echo "-### -Winvalid-or-nonexistent-directory -target x86_64-sie-ps5" > %t.rsp
21
22 /// If SDK headers and/or libraries are found, associated warnings are absent.
23 // RUN: rm -rf %t.inconly && mkdir -p %t.inconly/target/include
24 // RUN: env SCE_PROSPERO_SDK_DIR=%t.inconly %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-LIBS,NO-WARN %s
25
26 // RUN: rm -rf %t.libonly && mkdir -p %t.libonly/target/lib
27 // RUN: env SCE_PROSPERO_SDK_DIR=%t.libonly %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,NO-WARN %s
28
29 // RUN: rm -rf %t.both && mkdir -p %t.both/target/lib && mkdir %t.both/target/include
30 // RUN: env SCE_PROSPERO_SDK_DIR=%t.both %clang @%t.rsp %s 2>&1 | FileCheck -check-prefix=NO-WARN %s
31
32 /// In the following invocations, SCE_PROSPERO_SDK_DIR is set to an existing
33 /// location where SDK headers and libraries are absent.
34
35 /// When compiling and linking, we should see a warnings about both missing
36 /// headers and libraries.
37 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,WARN-SYS-LIBS,NO-WARN %s
38
39 /// -fthinlto-index= warning suppression.
40 // RUN: touch %t_dummy.o
41 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %t_dummy.o -fthinlto-index=ignored -c 2>&1 | FileCheck -check-prefixes=NO-WARN %s
42
43 /// If `-c`, `-S`, `-E` or `-emit-ast` is supplied, the existence check for SDK
44 /// libraries is skipped because no linking will be performed. We only expect
45 /// warnings about missing headers.
46 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -c 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,NO-WARN %s
47 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -S 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,NO-WARN %s
48 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -E 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,NO-WARN %s
49 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -emit-ast 2>&1 | FileCheck -check-prefixes=WARN-SYS-HEADERS,NO-WARN %s
50
51 /// If the user takes control of include paths, the existence check for headers
52 /// is not performed.
53 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -c -nostdinc 2>&1 | FileCheck -check-prefix=NO-WARN %s
54 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -c -nostdlibinc 2>&1 | FileCheck -check-prefix=NO-WARN %s
55 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -c -isysroot . 2>&1 | FileCheck -check-prefixes=NO-WARN %s
56 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -c --sysroot=. 2>&1 | FileCheck -check-prefixes=NO-WARN %s
57
58 /// --sysroot disables the existence check for headers. The check for libraries
59 /// remains.
60 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s --sysroot=. 2>&1 | FileCheck -check-prefixes=WARN-SYS-LIBS,NO-WARN %s
61
62 /// -isysroot overrides --sysroot for header search, but not library search.
63 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -isysroot . --sysroot=%t.inconly 2>&1 | FileCheck -check-prefixes=ISYSTEM,WARN-SYS-LIBS,NO-WARN %s
64 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s --sysroot=%t.inconly -isysroot . 2>&1 | FileCheck -check-prefixes=ISYSTEM,WARN-SYS-LIBS,NO-WARN %s
65
66 /// Warnings are emitted if non-existent --sysroot/-isysroot are supplied.
67 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s --sysroot=foo -isysroot %t.both 2>&1 | FileCheck -check-prefixes=WARN-SYSROOT,WARN-SYS-LIBS,NO-WARN %s
68 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s -isysroot foo --sysroot=%t.both 2>&1 | FileCheck -check-prefixes=WARN-SYSROOT,NO-WARN %s
69 // RUN: env SCE_PROSPERO_SDK_DIR=.. %clang @%t.rsp %s --sysroot=foo -isysroot bar 2>&1 | FileCheck -check-prefixes=WARN-SYSROOT,WARN-SYSROOT2,WARN-SYS-LIBS,NO-WARN %s
70
71 // NO-WARN-NOT: {{warning:|error:}}
72 // WARN-SYSROOT: warning: no such sysroot directory: 'foo'
73 // WARN-SYSROOT2: warning: no such sysroot directory: 'bar'
74 // WARN-SYS-LIBS: warning: unable to find PS5 system libraries directory
75 // WARN-SYS-HEADERS: warning: unable to find PS5 system headers directory
76 // NO-WARN-NOT: {{warning:|error:}}
77 // ISYSTEM: "-cc1"{{.*}}"-internal-externc-isystem" "./target/include"