Debian Codegraph @

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

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