File: implicit-ms-builtin-decl.c

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 995,836 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (44 lines) | stat: -rw-r--r-- 1,853 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s -fms-extensions
// RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -verify %s -fms-extensions

void f() {
  (void)_byteswap_ushort(42); // expected-warning{{implicitly declaring library function '_byteswap_ushort'}} \
  // expected-note{{include the header <stdlib.h> or explicitly provide a declaration for '_byteswap_ushort'}}
  (void)_byteswap_uint64(42LL); // expected-warning{{implicitly declaring library function '_byteswap_uint64'}} \
  // expected-note{{include the header <stdlib.h> or explicitly provide a declaration for '_byteswap_uint64'}}
}

void _byteswap_ulong(); // expected-warning{{incompatible redeclaration of library function '_byteswap_ulong'}} \
// expected-note{{'_byteswap_ulong' is a builtin}}

unsigned short _byteswap_ushort(unsigned short);
unsigned long long _byteswap_uint64(unsigned long long);

void g() {
  (void)_byteswap_ushort(42);
  (void)_byteswap_uint64(42LL);
}

#if defined(__x86_64__)
void h() {
  (void)__mulh(21, 2);  // expected-warning{{implicitly declaring library function '__mulh'}} \
  // expected-note{{include the header <intrin.h> or explicitly provide a declaration for '__mulh'}}
  (void)__umulh(21, 2); // expected-warning{{implicitly declaring library function '__umulh'}} \
  // expected-note{{include the header <intrin.h> or explicitly provide a declaration for '__umulh'}}
}

long long __mulh(long long, long long);
unsigned long long __umulh(unsigned long long, unsigned long long);

void i() {
  (void)__mulh(21, 2);
  (void)__umulh(21, 2);
}
#endif

#if defined(i386)
void h() {
  (void)__mulh(21LL, 2LL);  // expected-warning{{implicit declaration of function '__mulh' is invalid}}
  (void)__umulh(21ULL, 2ULL);  // expected-warning{{implicit declaration of function '__umulh' is invalid}}
}
#endif