1 /**************************************************************************** 2 * include/nuttx/compiler.h 3 * 4 * Licensed to the Apache Software Foundation (ASF) under one or more 5 * contributor license agreements. See the NOTICE file distributed with 6 * this work for additional information regarding copyright ownership. The 7 * ASF licenses this file to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance with the 9 * License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 * License for the specific language governing permissions and limitations 17 * under the License. 18 * 19 ****************************************************************************/ 20 21 #ifndef __INCLUDE_NUTTX_COMPILER_H 22 #define __INCLUDE_NUTTX_COMPILER_H 23 24 /**************************************************************************** 25 * Included Files 26 ****************************************************************************/ 27 28 #include <nuttx/config.h> 29 30 /**************************************************************************** 31 * Pre-processor Definitions 32 ****************************************************************************/ 33 34 /* GCC-specific definitions *************************************************/ 35 36 #ifdef __GNUC__ 37 38 /* Pre-processor */ 39 40 # define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */ 41 # define CONFIG_CPP_HAVE_WARNING 1 /* Supports #warning */ 42 43 /* Intriniscs. GCC supports __func__ but provides __FUNCTION__ for backward 44 * compatibility with older versions of GCC. 45 */ 46 47 # define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */ 48 # define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ 49 50 /* Indicate that a local variable is not used */ 51 52 # define UNUSED(a) ((void)(1 || (a))) 53 54 /* Built-in functions */ 55 56 /* The <stddef.h> header shall define the following macros: 57 * 58 * offsetof(type, member-designator) 59 * Integer constant expression of type size_t, the value of which is the 60 * offset in bytes to the structure member (member-designator), from the 61 * beginning of its structure (type). 62 * 63 * NOTE: This version of offsetof() depends on behaviors that could be 64 * undefined for some compilers. It would be better to use a builtin 65 * function if one exists. 66 * 67 * Reference: Opengroup.org 68 */ 69 #ifndef CONFIG_VFS_OFFSETOF_MARCO_DISABLE 70 # define offsetof(a, b) __builtin_offsetof(a, b) 71 #endif 72 73 /* GCC 4.x have __builtin_ctz(|l|ll) and __builtin_clz(|l|ll). These count 74 * trailing/leading zeros of input number and typically will generate few 75 * fast bit-counting instructions. Inputting zero to these functions is 76 * undefined and needs to be taken care of by the caller. 77 */ 78 79 #if __GNUC__ >= 4 80 # define CONFIG_HAVE_BUILTIN_CTZ 1 81 # define CONFIG_HAVE_BUILTIN_CLZ 1 82 # define CONFIG_HAVE_BUILTIN_POPCOUNT 1 83 #endif 84 85 /* C++ support */ 86 87 #if defined(__cplusplus) && __cplusplus >= 201402L 88 # define CONFIG_HAVE_CXX14 1 89 #else 90 # undef CONFIG_HAVE_CXX14 91 #endif 92 93 /* Attributes 94 * 95 * GCC supports weak symbols which can be used to reduce code size because 96 * unnecessary "weak" functions can be excluded from the link. 97 */ 98 99 # if !defined(__CYGWIN__) && !defined(CONFIG_ARCH_GNU_NO_WEAKFUNCTIONS) 100 # define CONFIG_HAVE_WEAKFUNCTIONS 1 101 # define weak_alias(name, aliasname) \ 102 extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); 103 # define weak_data __attribute__ ((weak)) 104 # define weak_function __attribute__ ((weak)) 105 # define weak_const_function __attribute__ ((weak, __const__)) 106 # else 107 # undef CONFIG_HAVE_WEAKFUNCTIONS 108 # define weak_alias(name, aliasname) 109 # define weak_data 110 # define weak_function 111 # define weak_const_function 112 # endif 113 114 /* The noreturn attribute informs GCC that the function will not return. 115 * C11 adds _Noreturn keyword (see stdnoreturn.h) 116 */ 117 118 # define noreturn_function __attribute__ ((noreturn)) 119 120 /* The farcall_function attribute informs GCC that is should use long calls 121 * (even though -mlong-calls does not appear in the compilation options) 122 */ 123 124 # define farcall_function __attribute__ ((long_call)) 125 126 /* Code locate */ 127 128 # define locate_code(n) __attribute__ ((section(n))) 129 130 /* Data alignment */ 131 132 # define aligned_data(n) __attribute__ ((aligned(n))) 133 134 /* Data location */ 135 136 # define locate_data(n) __attribute__ ((section(n))) 137 138 /* The packed attribute informs GCC that the structure elements are packed, 139 * ignoring other alignment rules. 140 */ 141 142 # define begin_packed_struct 143 # define end_packed_struct __attribute__ ((packed)) 144 145 /* GCC does not support the reentrant attribute */ 146 147 # define reentrant_function 148 149 /* The naked attribute informs GCC that the programmer will take care of 150 * the function prolog and epilog. 151 */ 152 153 # define naked_function __attribute__ ((naked,no_instrument_function)) 154 155 /* The inline_function attribute informs GCC that the function should always 156 * be inlined, regardless of the level of optimization. The 157 * noinline_function indicates that the function should never be inlined. 158 */ 159 160 # define inline_function __attribute__ ((always_inline,no_instrument_function)) 161 # define noinline_function __attribute__ ((noinline)) 162 163 /* The noinstrument_function attribute informs GCC don't instrument it */ 164 165 # define noinstrument_function __attribute__ ((no_instrument_function)) 166 167 /* The nostackprotect_function attribute disables stack protection in 168 * sensitive functions, e.g., stack coloration routines. 169 */ 170 171 #if defined(__has_attribute) 172 # if __has_attribute(no_stack_protector) 173 # define nostackprotect_function __attribute__ ((no_stack_protector)) 174 # endif 175 #endif 176 177 /* nostackprotect_function definition for older versions of GCC and Clang. 178 * Note that Clang does not support setting per-function optimizations, 179 * simply disable the entire optimization pass for the required function. 180 */ 181 182 #ifndef nostackprotect_function 183 # if defined(__clang__) 184 # define nostackprotect_function __attribute__ ((optnone)) 185 # else 186 # define nostackprotect_function __attribute__ ((__optimize__ ("-fno-stack-protector"))) 187 # endif 188 #endif 189 190 /* The unsued code or data */ 191 192 # define unused_code __attribute__((unused)) 193 # define unused_data __attribute__((unused)) 194 195 /* Some versions of GCC have a separate __syslog__ format. 196 * http://mail-index.netbsd.org/source-changes/2015/10/14/msg069435.html 197 * Use it if available. Otherwise, assume __printf__ accepts %m. 198 */ 199 200 # if !defined(__syslog_attribute__) 201 # define __syslog__ __printf__ 202 # endif 203 204 # define formatlike(a) __attribute__((__format_arg__ (a))) 205 # define printflike(a, b) __attribute__((__format__ (__printf__, a, b))) 206 # define sysloglike(a, b) __attribute__((__format__ (__syslog__, a, b))) 207 # define scanflike(a, b) __attribute__((__format__ (__scanf__, a, b))) 208 # define strftimelike(a) __attribute__((__format__ (__strftime__, a, 0))) 209 210 /* GCC does not use storage classes to qualify addressing */ 211 212 # define FAR 213 # define NEAR 214 # define DSEG 215 # define CODE 216 217 /* Define these here and allow specific architectures to override as needed */ 218 219 # define CONFIG_HAVE_LONG_LONG 1 220 # define CONFIG_HAVE_FLOAT 1 221 # define CONFIG_HAVE_DOUBLE 1 222 # define CONFIG_HAVE_LONG_DOUBLE 1 223 224 /* Handle cases where sizeof(int) is 16-bits, sizeof(long) is 32-bits, and 225 * pointers are 16-bits. 226 */ 227 228 #if defined(__m32c__) 229 /* No I-space access qualifiers */ 230 231 # define IOBJ 232 # define IPTR 233 234 /* Select the small, 16-bit addressing model */ 235 236 # define CONFIG_SMALL_MEMORY 1 237 238 /* Long and int are not the same size */ 239 240 # define CONFIG_LONG_IS_NOT_INT 1 241 242 /* Pointers and int are the same size */ 243 244 # undef CONFIG_PTR_IS_NOT_INT 245 246 #elif defined(__AVR__) 247 # if defined(CONFIG_AVR_HAS_MEMX_PTR) 248 /* I-space access qualifiers needed by Harvard architecture */ 249 250 # define IOBJ __flash 251 # define IPTR __memx 252 253 # else 254 /* No I-space access qualifiers */ 255 256 # define IOBJ 257 # define IPTR 258 # endif 259 260 /* Select the small, 16-bit addressing model (for D-Space) */ 261 262 # define CONFIG_SMALL_MEMORY 1 263 264 /* Long and int are not the same size */ 265 266 # define CONFIG_LONG_IS_NOT_INT 1 267 268 /* Pointers and int are the same size */ 269 270 # undef CONFIG_PTR_IS_NOT_INT 271 272 /* Uses a 32-bit FAR pointer only from accessing data outside of the 16-bit 273 * data space. 274 */ 275 276 # define CONFIG_HAVE_FARPOINTER 1 277 278 #elif defined(__mc68hc1x__) 279 280 /* No I-space access qualifiers */ 281 282 # define IOBJ 283 # define IPTR 284 285 /* Select the small, 16-bit addressing model */ 286 287 # define CONFIG_SMALL_MEMORY 1 288 289 /* Normally, mc68hc1x code is compiled with the -mshort option 290 * which results in a 16-bit integer. If -mnoshort is defined 291 * then an integer is 32-bits. GCC will defined __INT__ accordingly: 292 */ 293 294 # if __INT__ == 16 295 /* int is 16-bits, long is 32-bits */ 296 297 # define CONFIG_LONG_IS_NOT_INT 1 298 299 /* Pointers and int are the same size (16-bits) */ 300 301 # undef CONFIG_PTR_IS_NOT_INT 302 # else 303 /* int and long are both 32-bits */ 304 305 # undef CONFIG_LONG_IS_NOT_INT 306 307 /* Pointers and int are NOT the same size */ 308 309 # define CONFIG_PTR_IS_NOT_INT 1 310 # endif 311 312 #elif defined(_EZ80ACCLAIM) 313 314 /* No I-space access qualifiers */ 315 316 # define IOBJ 317 # define IPTR 318 319 /* Select the large, 24-bit addressing model */ 320 321 # undef CONFIG_SMALL_MEMORY 322 323 /* int is 24-bits, long is 32-bits */ 324 325 # define CONFIG_LONG_IS_NOT_INT 1 326 327 /* pointers are 24-bits too */ 328 329 # undef CONFIG_PTR_IS_NOT_INT 330 331 /* the ez80 stdlib doesn't support doubles */ 332 333 # undef CONFIG_HAVE_DOUBLE 334 # undef CONFIG_HAVE_LONG_DOUBLE 335 336 #else 337 338 /* No I-space access qualifiers */ 339 340 # define IOBJ 341 # define IPTR 342 343 /* Select the large, 32-bit addressing model */ 344 345 # undef CONFIG_SMALL_MEMORY 346 347 /* Long and int are (probably) the same size (32-bits) */ 348 349 # undef CONFIG_LONG_IS_NOT_INT 350 351 /* Pointers and int are the same size (32-bits) */ 352 353 # undef CONFIG_PTR_IS_NOT_INT 354 355 #endif 356 357 /* ISO C11 supports anonymous (unnamed) structures and unions, added in 358 * GCC 4.6 (but might be suppressed with -std= option). ISO C++11 also 359 * adds un-named unions, but NOT unnamed structures (although compilers 360 * may support them). 361 * 362 * CAREFUL: This can cause issues for shared data structures shared between 363 * C and C++ if the two versions do not support the same features. 364 * Structures and unions can lose binary compatibility! 365 * 366 * NOTE: The NuttX coding standard forbids the use of unnamed structures and 367 * unions within the OS. 368 */ 369 370 # undef CONFIG_HAVE_ANONYMOUS_STRUCT 371 # undef CONFIG_HAVE_ANONYMOUS_UNION 372 373 # if (defined(__cplusplus) && __cplusplus >= 201103L) || \ 374 (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) 375 # define CONFIG_HAVE_ANONYMOUS_STRUCT 1 376 # define CONFIG_HAVE_ANONYMOUS_UNION 1 377 # endif 378 379 /* Indicate that a local variable is not used */ 380 381 # define UNUSED(a) ((void)(1 || (a))) 382 383 /* SDCC-specific definitions ************************************************/ 384 385 #elif defined(SDCC) || defined(__SDCC) 386 387 /* No I-space access qualifiers */ 388 389 # define IOBJ 390 # define IPTR 391 392 /* Pre-processor */ 393 394 # define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */ 395 # define CONFIG_CPP_HAVE_WARNING 1 /* Supports #warning */ 396 397 /* Intriniscs */ 398 399 # define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */ 400 # define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ 401 # define __FUNCTION__ __func__ /* SDCC supports on __func__ */ 402 403 /* Pragmas 404 * 405 * Disable warnings for unused function arguments 406 */ 407 408 # pragma disable_warning 85 409 410 /* C++ support */ 411 412 # undef CONFIG_HAVE_CXX14 413 414 /* Attributes 415 * 416 * SDCC does not support weak symbols 417 */ 418 419 # undef CONFIG_HAVE_WEAKFUNCTIONS 420 # define weak_alias(name, aliasname) 421 # define weak_data 422 # define weak_function 423 # define weak_const_function 424 # define restrict /* REVISIT */ 425 426 /* SDCC does not support the noreturn or packed attributes */ 427 428 /* Current SDCC supports noreturn via C11 _Noreturn keyword (see 429 * stdnoreturn.h). 430 */ 431 432 # define noreturn_function 433 # define locate_code(n) 434 # define aligned_data(n) 435 # define locate_data(n) 436 # define begin_packed_struct 437 # define end_packed_struct 438 439 /* REVISIT: */ 440 441 # define farcall_function 442 443 /* SDCC does support "naked" functions */ 444 445 # define naked_function __naked 446 447 /* SDCC does not support forced inlining. */ 448 449 # define inline_function 450 # define noinline_function 451 # define noinstrument_function 452 # define nostackprotect_function 453 454 # define unused_code 455 # define unused_data 456 457 # define formatlike(a) 458 # define printflike(a, b) 459 # define sysloglike(a, b) 460 # define scanflike(a, b) 461 # define strftimelike(a) 462 463 /* The reentrant attribute informs SDCC that the function 464 * must be reentrant. In this case, SDCC will store input 465 * arguments on the stack to support reentrancy. 466 * 467 * SDCC functions are always reentrant (except for the mcs51, 468 * ds390, hc08 and s08 backends) 469 */ 470 471 # define reentrant_function __reentrant 472 473 /* ISO C11 supports anonymous (unnamed) structures and unions. Does SDCC? */ 474 475 # undef CONFIG_HAVE_ANONYMOUS_STRUCT 476 # undef CONFIG_HAVE_ANONYMOUS_UNION 477 478 /* Indicate that a local variable is not used */ 479 480 # define UNUSED(a) ((void)(1 || (a))) 481 482 /* It is assumed that the system is build using the small 483 * data model with storage defaulting to internal RAM. 484 * The NEAR storage class can also be used to address data 485 * in internal RAM; FAR can be used to address data in 486 * external RAM. 487 */ 488 489 #if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_gbz80) 490 # define FAR 491 # define NEAR 492 # define CODE 493 # define DSEG 494 #else 495 # define FAR __xdata 496 # define NEAR __data 497 # define CODE __code 498 # if defined(SDCC_MODEL_SMALL) 499 # define DSEG __data 500 # else 501 # define DSEG __xdata 502 # endif 503 #endif 504 505 /* Select small, 16-bit address model */ 506 507 # define CONFIG_SMALL_MEMORY 1 508 509 /* Long and int are not the same size */ 510 511 # define CONFIG_LONG_IS_NOT_INT 1 512 513 /* The generic pointer and int are not the same size (for some SDCC 514 * architectures). REVISIT: SDCC now has more backends where pointers are 515 * the same size as int than just z80 and z180. 516 */ 517 518 #if !defined(__z80) && !defined(__gbz80) 519 # define CONFIG_PTR_IS_NOT_INT 1 520 #endif 521 522 /* SDCC does types long long and float, but not types double and long 523 * double. 524 */ 525 526 # define CONFIG_HAVE_LONG_LONG 1 527 # define CONFIG_HAVE_FLOAT 1 528 # undef CONFIG_HAVE_DOUBLE 529 # undef CONFIG_HAVE_LONG_DOUBLE 530 531 /* Indicate that a local variable is not used */ 532 533 # define UNUSED(a) ((void)(1 || (a))) 534 535 # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) 536 537 /* Zilog-specific definitions ***********************************************/ 538 539 #elif defined(__ZILOG__) 540 541 /* At present, only the following Zilog compilers are recognized */ 542 543 # if !defined(__ZNEO__) && !defined(__EZ8__) && !defined(__EZ80__) 544 # warning "Unrecognized Zilog compiler" 545 # endif 546 547 /* Pre-processor */ 548 549 # undef CONFIG_CPP_HAVE_VARARGS /* No variable argument macros */ 550 # undef CONFIG_CPP_HAVE_WARNING /* Does not support #warning */ 551 552 /* Intrinsics */ 553 554 # define CONFIG_HAVE_FUNCTIONNAME 1 /* Has __FUNCTION__ */ 555 # define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ 556 557 /* No I-space access qualifiers */ 558 559 # define IOBJ 560 # define IPTR 561 562 /* C++ support */ 563 564 # undef CONFIG_HAVE_CXX14 565 566 /* Attributes 567 * 568 * The Zilog compiler does not support weak symbols 569 */ 570 571 # undef CONFIG_HAVE_WEAKFUNCTIONS 572 # define weak_alias(name, aliasname) 573 # define weak_data 574 # define weak_function 575 # define weak_const_function 576 # define restrict 577 578 /* The Zilog compiler does not support the noreturn, packed, naked 579 * attributes. 580 */ 581 582 # define noreturn_function 583 # define aligned_data(n) 584 # define locate_code(n) 585 # define locate_data(n) 586 # define begin_packed_struct 587 # define end_packed_struct 588 # define naked_function 589 # define inline_function 590 # define noinline_function 591 # define noinstrument_function 592 # define nostackprotect_function 593 # define unused_code 594 # define unused_data 595 # define formatlike(a) 596 # define printflike(a, b) 597 # define sysloglike(a, b) 598 # define scanflike(a, b) 599 # define strftimelike(a) 600 601 /* REVISIT: */ 602 603 # define farcall_function 604 605 /* The Zilog compiler does not support the reentrant attribute */ 606 607 # define reentrant_function 608 609 /* Addressing. 610 * 611 * Z16F ZNEO: Far is 24-bits; near is 16-bits of address. 612 * The supported model is (1) all code on ROM, and (2) all data 613 * and stacks in external (far) RAM. 614 * Z8Encore!: Far is 16-bits; near is 8-bits of address. 615 * The supported model is (1) all code on ROM, and (2) all data 616 * and stacks in internal (far) RAM. 617 * Z8Acclaim: In Z80 mode, all pointers are 16-bits. In ADL mode, all 618 * pointers are 24 bits. 619 */ 620 621 # if defined(__ZNEO__) 622 # define FAR _Far 623 # define NEAR _Near 624 # define DSEG _Far 625 # define CODE _Erom 626 # undef CONFIG_SMALL_MEMORY /* Select the large, 32-bit addressing model */ 627 # undef CONFIG_LONG_IS_NOT_INT /* Long and int are the same size */ 628 # undef CONFIG_PTR_IS_NOT_INT /* FAR pointers and int are the same size */ 629 # elif defined(__EZ8__) 630 # define FAR far 631 # define NEAR near 632 # define DSEG far 633 # define CODE rom 634 # define CONFIG_SMALL_MEMORY 1 /* Select small, 16-bit address model */ 635 # define CONFIG_LONG_IS_NOT_INT 1 /* Long and int are not the same size */ 636 # undef CONFIG_PTR_IS_NOT_INT /* FAR pointers and int are the same size */ 637 # elif defined(__EZ80__) 638 # define FAR 639 # define NEAR 640 # define DSEG 641 # define CODE 642 # undef CONFIG_SMALL_MEMORY /* Select the large, 32-bit addressing model */ 643 # define CONFIG_LONG_IS_NOT_INT 1 /* Long and int are not the same size */ 644 # ifdef CONFIG_EZ80_Z80MODE 645 # define CONFIG_PTR_IS_NOT_INT 1 /* Pointers and int are not the same size */ 646 # else 647 # undef CONFIG_PTR_IS_NOT_INT /* Pointers and int are the same size */ 648 # endif 649 # endif 650 651 /* ISO C11 supports anonymous (unnamed) structures and unions. Zilog does 652 * not support C11 653 */ 654 655 # undef CONFIG_HAVE_ANONYMOUS_STRUCT 656 # undef CONFIG_HAVE_ANONYMOUS_UNION 657 658 /* Older Zilog compilers support both types double and long long, but the 659 * size is 32-bits (same as long and single precision) so it is safer to say 660 * that they are not supported. Later versions are more ANSII compliant and 661 * simply do not support long long or double. 662 */ 663 664 # undef CONFIG_HAVE_LONG_LONG 665 # define CONFIG_HAVE_FLOAT 1 666 # undef CONFIG_HAVE_DOUBLE 667 # undef CONFIG_HAVE_LONG_DOUBLE 668 669 /* Indicate that a local variable is not used */ 670 671 # define UNUSED(a) ((void)(1 || (a))) 672 673 # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) 674 675 /* ICCARM-specific definitions **********************************************/ 676 677 #elif defined(__ICCARM__) 678 679 # define CONFIG_CPP_HAVE_VARARGS 1 /* Supports variable argument macros */ 680 # define CONFIG_HAVE_FILENAME 1 /* Has __FILE__ */ 681 # define CONFIG_HAVE_FLOAT 1 682 683 /* Indicate that a local variable is not used */ 684 685 # define UNUSED(a) ((void)(1 || (a))) 686 687 # define weak_alias(name, aliasname) 688 # define weak_data __weak 689 # define weak_function __weak 690 # define weak_const_function 691 # define noreturn_function 692 # define farcall_function 693 # define locate_code(n) 694 # define aligned_data(n) 695 # define locate_data(n) 696 # define begin_packed_struct __packed 697 # define end_packed_struct 698 # define reentrant_function 699 # define naked_function 700 # define inline_function 701 # define noinline_function 702 # define noinstrument_function 703 # define nostackprotect_function 704 # define unused_code 705 # define unused_data 706 # define formatlike(a) 707 # define printflike(a, b) 708 # define sysloglike(a, b) 709 # define scanflike(a, b) 710 # define strftimelike(a) 711 712 # define FAR 713 # define NEAR 714 # define DSEG 715 # define CODE 716 # define IOBJ 717 # define IPTR 718 719 # define __asm__ asm 720 # define __volatile__ volatile 721 722 /* For operatots __sfb() and __sfe() */ 723 724 # pragma section = ".bss" 725 # pragma section = ".data" 726 # pragma section = ".data_init" 727 # pragma section = ".text" 728 729 /* C++ support */ 730 731 # undef CONFIG_HAVE_CXX14 732 733 /* ISO C11 supports anonymous (unnamed) structures and unions. Does 734 * ICCARM? 735 */ 736 737 # undef CONFIG_HAVE_ANONYMOUS_STRUCT 738 # undef CONFIG_HAVE_ANONYMOUS_UNION 739 740 # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) 741 742 /* Unknown compiler *********************************************************/ 743 744 #else 745 746 # undef CONFIG_CPP_HAVE_VARARGS 747 # undef CONFIG_CPP_HAVE_WARNING 748 # undef CONFIG_HAVE_FUNCTIONNAME 749 # undef CONFIG_HAVE_FILENAME 750 # undef CONFIG_HAVE_WEAKFUNCTIONS 751 # undef CONFIG_HAVE_CXX14 752 # define weak_alias(name, aliasname) 753 # define weak_data 754 # define weak_function 755 # define weak_const_function 756 # define restrict 757 # define noreturn_function 758 # define farcall_function 759 # define aligned_data(n) 760 # define locate_code(n) 761 # define locate_data(n) 762 # define begin_packed_struct 763 # define end_packed_struct 764 # define reentrant_function 765 # define naked_function 766 # define inline_function 767 # define noinline_function 768 # define noinstrument_function 769 # define nostackprotect_function 770 # define unused_code 771 # define unused_data 772 # define formatlike(a) 773 # define printflike(a, b) 774 # define sysloglike(a, b) 775 # define scanflike(a, b) 776 # define strftimelike(a) 777 778 # define FAR 779 # define NEAR 780 # define DSEG 781 # define CODE 782 783 # undef CONFIG_SMALL_MEMORY 784 # undef CONFIG_LONG_IS_NOT_INT 785 # undef CONFIG_PTR_IS_NOT_INT 786 # undef CONFIG_HAVE_LONG_LONG 787 # define CONFIG_HAVE_FLOAT 1 788 # undef CONFIG_HAVE_DOUBLE 789 # undef CONFIG_HAVE_LONG_DOUBLE 790 # undef CONFIG_HAVE_ANONYMOUS_STRUCT 791 # undef CONFIG_HAVE_ANONYMOUS_UNION 792 793 # define UNUSED(a) ((void)(1 || (a))) 794 795 # define offsetof(a, b) ((size_t)(&(((a *)(0))->b))) 796 797 #endif 798 799 /**************************************************************************** 800 * Public Function Prototypes 801 ****************************************************************************/ 802 803 /**************************************************************************** 804 * Public Function Prototypes 805 ****************************************************************************/ 806 807 #ifdef __cplusplus 808 #define EXTERN extern "C" 809 extern "C" 810 { 811 #else 812 #define EXTERN extern 813 #endif 814 815 #undef EXTERN 816 #ifdef __cplusplus 817 } 818 #endif 819 820 #endif /* __INCLUDE_NUTTX_COMPILER_H */ 821