yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

jsmall-nvidiaTesting using a 'naked' ISlangFileSystemExt option. (#1026)328414431

master
1.4 KiB60 linesraw
1//TEST(smoke):SIMPLE:
2//TEST(smoke):SIMPLE: -file-system load-file
3//TEST(smoke):SIMPLE: -file-system os
4
5// Test support for `#pragma once`
6
7// We will include two header files:
8// one that uses `#pragma once`, and
9// one that doesn't.
10//
11// The first file defines a function `foo()`,
12// and the second defines a macro `BAR`
13//
14#include "pragma-once-a.h"
15#include "pragma-once-b.h"
16
17// We will include the files again, and
18// before we do so we need to undefine
19// the macro from the second file so
20// that it doesn't get a redefinition diagnostic.
21//
22#undef BAR
23//
24// We don't do anything about the function
25// in the first file, because we expect
26// the `#pragma once` to cause it to be
27// ignored on this second time.
28//
29#include "pragma-once-a.h"
30#include "pragma-once-b.h"
31
32// Make sure relative paths are handled
33#include "./pragma-once-a.h"
34#include "./pragma-once-a.h"
35
36#include ".\pragma-once-a.h"
37#include "./include\../pragma-once-a.h"
38
39#include "../preprocessor/./pragma-once-a.h"
40
41#include "include/pragma-once-c.h"
42#include "./include\pragma-once-c.h"
43
44#ifndef ONLY_DEFINED_ONCE_C
45#undef BAR
46#endif
47
48// Now let's use both the function and the
49// macro, to confirm that they are both
50// defined as expected.
51//
52// Note: if we accidentally include file
53// `a.h` more than once, we'd expect to
54// get an error here, because the two
55// function definitions conflict.
56//
57float test(float x)
58{
59	return foo(x) + BAR(x);
60}