1
+ // UNSUPPORTED: system-windows
2
+ // RUN: %cc-x86_64 %s -g -c -o %t.o
3
+ // RUN: %decompile-headless --input %t.o --function widechar_test --output %t %ci_output_folder
4
+ // RUN: %file-check -vv --check-prefix=DECOMPILES %s --input-file %t
5
+ // DECOMPILES: "name":"{{_?widechar_test}}"
6
+
7
+ // RUN: %decompile-headless --input %t.o --output %t %ci_output_folder
8
+ // RUN: %file-check -vv --check-prefix=DECOMPILEA %s --input-file %t
9
+ // DECOMPILEA: "arch":"{{.*}}","format":"{{.*}}","functions":
10
+ // DECOMPILEA-SAME: "name":"{{_?widechar_test}}"
11
+ // DECOMPILEA-SAME: "name":"{{_?main}}"
12
+
13
+ // RUN: %decompile-headless --input %t.o --list-functions --output %t %ci_output_folder
14
+ // RUN: %file-check -vv --check-prefix=LISTFNS %s --input-file %t
15
+ // LISTFNS: "program":"{{.*}}","functions":
16
+ // LISTFNS-SAME: "name":"{{_?widechar_test}}"
17
+ // LISTFNS-SAME: "name":"{{_?main}}"
18
+
19
+ #include <stdio.h>
20
+ #include <wchar.h>
21
+ #include <locale.h>
22
+
23
+ int widechar_test () {
24
+ // Set the locale to the user's preferred locale
25
+ setlocale (LC_ALL , "" );
26
+
27
+ // Declare and initialize a wide string (wide character array)
28
+ wchar_t wide_str [] = L"Hello, 世界!" ; // "Hello, World!" in Chinese
29
+ // Print the wide string
30
+ wprintf (L"%ls\n" , wide_str );
31
+ // Print a wide character
32
+ wchar_t wide_char = L'😊' ; // A smiley emoji
33
+ wprintf (L"Wide character: %lc\n" , wide_char );
34
+ return 0 ;
35
+ }
36
+
37
+ int main (void ) {
38
+ return widechar_test ();
39
+ }
0 commit comments