History

Add test for __*LP*__ predefined macros

Christian Jullien committed 10 years ago

Commit e91ce661 parent c9487322 files · +39 −0Browse files

Unified · Split

2 files
  1. tests/tests2/86-memory-model.c +38 −0
  2. tests/tests2/86-memory-model.expect +1 −0
tests/tests2/86-memory-model.c+38−0
@@ -0,0 +1,38 @@
1+#include <stdio.h>
2+
3+int
4+main()
5+{
6+#if defined(__LLP64__)
7+ if (sizeof(short) == 2
8+ sizeof(int) == 4
9+ sizeof(long int) == 4
10+ sizeof(long long int) == 8
11+ sizeof(void*) == 8) {
12+ (void)printf("Ok\n");
13+ } else {
14+ (void)printf("KO __LLP64__\n");
15+ }
16+#elif defined(__LP64__)
17+ if (sizeof(short) == 2
18+ sizeof(int) == 4
19+ sizeof(long int) == 8
20+ sizeof(long long int) == 8
21+ sizeof(void*) == 8) {
22+ (void)printf("Ok\n");
23+ } else {
24+ (void)printf("KO __LP64__\n");
25+ }
26+#elif defined(__ILP32__)
27+ if (sizeof(short) == 2
28+ sizeof(int) == 4
29+ sizeof(long int) == 4
30+ sizeof(void*) == 4) {
31+ (void)printf("Ok\n");
32+ } else {
33+ (void)printf("KO __ILP32__\n");
34+ }
35+#else
36+ (void)printf("KO no __*LP*__ defined.\n");
37+#endif
38+}
tests/tests2/86-memory-model.expect+1−0
@@ -0,0 +1 @@
1+Ok

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t