| ... | @@ -2879,7 +2879,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2879,7 +2879,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2879 | , &[_][]const u8{ | 2879 | , &[_][]const u8{ |
| 2880 | \\pub const FOO = 0x61626364; | 2880 | \\pub const FOO = 0x61626364; |
| 2881 | }); | 2881 | }); |
| 2882 | | 2882 | |
| 2883 | cases.add("Make sure casts are grouped", | 2883 | cases.add("Make sure casts are grouped", |
| 2884 | \\typedef struct | 2884 | \\typedef struct |
| 2885 | \\{ | 2885 | \\{ |
| ... | @@ -2910,4 +2910,49 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2910,4 +2910,49 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2910 | , | 2910 | , |
| 2911 | \\pub const GPIO_2_MEM_MAP = @intToPtr([*c]c_uint, 0x8008); | 2911 | \\pub const GPIO_2_MEM_MAP = @intToPtr([*c]c_uint, 0x8008); |
| 2912 | }); | 2912 | }); |
| | 2913 | |
| | 2914 | if (std.Target.current.abi == .msvc) { |
| | 2915 | cases.add("nameless struct fields", |
| | 2916 | \\typedef struct NAMED |
| | 2917 | \\{ |
| | 2918 | \\ long name; |
| | 2919 | \\} NAMED; |
| | 2920 | \\ |
| | 2921 | \\typedef struct ONENAMEWITHSTRUCT |
| | 2922 | \\{ |
| | 2923 | \\ NAMED; |
| | 2924 | \\ long b; |
| | 2925 | \\} ONENAMEWITHSTRUCT; |
| | 2926 | , &[_][]const u8{ |
| | 2927 | \\pub const struct_NAMED = extern struct { |
| | 2928 | \\ name: c_long, |
| | 2929 | \\}; |
| | 2930 | \\pub const NAMED = struct_NAMED; |
| | 2931 | \\pub const struct_ONENAMEWITHSTRUCT = extern struct { |
| | 2932 | \\ unnamed_1: struct_NAMED, |
| | 2933 | \\ b: c_long, |
| | 2934 | \\}; |
| | 2935 | }); |
| | 2936 | } else { |
| | 2937 | cases.add("nameless struct fields", |
| | 2938 | \\typedef struct NAMED |
| | 2939 | \\{ |
| | 2940 | \\ long name; |
| | 2941 | \\} NAMED; |
| | 2942 | \\ |
| | 2943 | \\typedef struct ONENAMEWITHSTRUCT |
| | 2944 | \\{ |
| | 2945 | \\ NAMED; |
| | 2946 | \\ long b; |
| | 2947 | \\} ONENAMEWITHSTRUCT; |
| | 2948 | , &[_][]const u8{ |
| | 2949 | \\pub const struct_NAMED = extern struct { |
| | 2950 | \\ name: c_long, |
| | 2951 | \\}; |
| | 2952 | \\pub const NAMED = struct_NAMED; |
| | 2953 | \\pub const struct_ONENAMEWITHSTRUCT = extern struct { |
| | 2954 | \\ b: c_long, |
| | 2955 | \\}; |
| | 2956 | }); |
| | 2957 | } |
| 2913 | } | 2958 | } |