Overview
Comment: | OFMethodSignature: Fix align inside structs on x86 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b31e47c23ee0375a753332dd0fa9f664 |
User & Date: | js on 2018-02-11 21:06:53 |
Other Links: | manifest | tags |
Context
2018-02-11
| ||
23:21 | Add .travis.yml check-in: 9607870d0b user: js tags: trunk | |
21:06 | OFMethodSignature: Fix align inside structs on x86 check-in: b31e47c23e user: js tags: trunk | |
15:17 | Update buildsys check-in: 7482940215 user: js tags: trunk | |
Changes
Modified src/OFMethodSignature.m from [ba6ce52679] to [c051dfe1af].
︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - + | #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "macros.h" |
︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - + | @throw [OFInvalidFormatException exception]; /* Skip '=' */ (*type)++; (*length)--; while (*length > 0 && **type != '}') { |
︙ | |||
127 128 129 130 131 132 133 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + - + | @throw [OFInvalidFormatException exception]; /* Skip '=' */ (*type)++; (*length)--; while (*length > 0 && **type != ')') { |
︙ | |||
177 178 179 180 181 182 183 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | + + + + + - + + + + + + - + + + + + + - + | break; case 'l': case 'L': align = OF_ALIGNOF(long); break; case 'q': case 'Q': #ifdef OF_X86 if (inStruct) align = 4; else #endif |
︙ | |||
222 223 224 225 226 227 228 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | - + + + + + + - + | return alignofStruct(type, length); case '(': return alignofUnion(type, length); case '^': /* Just to skip over the rest */ (*type)++; (*length)--; |
︙ | |||
329 330 331 332 333 334 335 | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | - + | while (*length > 0 && **type != '}') { size_t fieldSize, fieldAlign; typeCopy = *type; lengthCopy = *length; fieldSize = sizeofEncoding(type, length); |
︙ | |||
543 544 545 546 547 548 549 | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - + | return ret; } size_t of_alignof_type_encoding(const char *type) { size_t length = strlen(type); |
︙ |
Modified tests/OFMethodSignatureTests.m from [8cbc481dee] to [c008280f35].
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | + + + + | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #if !defined(__STDC_NO_COMPLEX__) && defined(HAVE_COMPLEX_H) # include <complex.h> #endif #import "OFMethodSignature.h" #import "OFAutoreleasePool.h" #import "OFInvalidFormatException.h" #import "TestsAppDelegate.h" |
︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | + + + + + + + | } st; union { char c; int i; } u; double d; }; #if !defined(__STDC_NO_COMPLEX__) && defined(HAVE_COMPLEX_H) struct test3_struct { char c; complex double cd; }; #endif union test3_union { char c; int i; double d; }; |
︙ | |||
119 120 121 122 123 124 125 126 127 128 129 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | + + + + + + - + - + + + + + + + - + - + | of_sizeof_type_encoding(@encode(struct test1_struct)) == sizeof(struct test1_struct)) TEST(@"of_sizeof_type_encoding() #2", of_sizeof_type_encoding(@encode(struct test2_struct)) == sizeof(struct test2_struct)) #if !defined(__STDC_NO_COMPLEX__) && defined(HAVE_COMPLEX_H) TEST(@"of_sizeof_type_encoding() #3", of_sizeof_type_encoding(@encode(struct test3_struct)) == sizeof(struct test3_struct)) #endif TEST(@"of_sizeof_type_encoding() #4", of_sizeof_type_encoding(@encode(union test3_union)) == sizeof(union test3_union)) |