RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
include
rtems
score
basedefs.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
11
12
/*
13
* Copyright (C) 2014 Pavel Pisa
14
* Copyright (C) 2011, 2013 On-Line Applications Research Corporation (OAR)
15
* Copyright (C) 2009, 2023 embedded brains GmbH & Co. KG
16
*
17
* Redistribution and use in source and binary forms, with or without
18
* modification, are permitted provided that the following conditions
19
* are met:
20
* 1. Redistributions of source code must retain the above copyright
21
* notice, this list of conditions and the following disclaimer.
22
* 2. Redistributions in binary form must reproduce the above copyright
23
* notice, this list of conditions and the following disclaimer in the
24
* documentation and/or other materials provided with the distribution.
25
*
26
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
* POSSIBILITY OF SUCH DAMAGE.
37
*/
38
39
/*
40
* This file is part of the RTEMS quality process and was automatically
41
* generated. If you find something that needs to be fixed or
42
* worded better please post a report or patch to an RTEMS mailing list
43
* or raise a bug report:
44
*
45
* https://www.rtems.org/bugs.html
46
*
47
* For information on updating and regenerating please refer to the How-To
48
* section in the Software Requirements Engineering chapter of the
49
* RTEMS Software Engineering manual. The manual is provided as a part of
50
* a release. For development sources please refer to the online
51
* documentation at:
52
*
53
* https://docs.rtems.org
54
*/
55
56
/* Generated from spec:/rtems/basedefs/if/header */
57
58
#ifndef _RTEMS_SCORE_BASEDEFS_H
59
#define _RTEMS_SCORE_BASEDEFS_H
60
61
#include <rtems/score/cpuopts.h>
62
63
#if !defined(ASM)
64
#include <stdbool.h>
65
#include <stddef.h>
66
#include <stdint.h>
67
#endif
68
69
#ifdef __cplusplus
70
extern
"C"
{
71
#endif
72
73
/* Generated from spec:/if/group */
74
81
82
/* Generated from spec:/rtems/basedefs/if/group */
83
92
93
/* Generated from spec:/rtems/basedefs/if/alias */
94
102
#if defined(__GNUC__)
103
#define RTEMS_ALIAS( _target ) __attribute__(( __alias__( #_target ) ))
104
#else
105
#define RTEMS_ALIAS( _target )
106
#endif
107
108
/* Generated from spec:/rtems/basedefs/if/align-down */
109
123
#define RTEMS_ALIGN_DOWN( _value, _alignment ) \
124
( ( _value ) & ~( ( _alignment ) - 1 ) )
125
126
/* Generated from spec:/rtems/basedefs/if/align-up */
127
141
#define RTEMS_ALIGN_UP( _value, _alignment ) \
142
( ( ( _value ) + ( _alignment ) - 1 ) & ~( ( _alignment ) - 1 ) )
143
144
/* Generated from spec:/rtems/basedefs/if/aligned */
145
154
#if defined(__GNUC__)
155
#define RTEMS_ALIGNED( _alignment ) __attribute__(( __aligned__( _alignment ) ))
156
#else
157
#define RTEMS_ALIGNED( _alignment )
158
#endif
159
160
/* Generated from spec:/rtems/basedefs/if/alignof */
161
171
#if defined( __cplusplus ) && __cplusplus >= 201103L
172
#define RTEMS_ALIGNOF( _type_name ) alignof( _type_name )
173
#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 201112L
174
#define RTEMS_ALIGNOF( _type_name ) _Alignof( _type_name )
175
#else
176
#define RTEMS_ALIGNOF( _type_name ) sizeof( _type_name )
177
#endif
178
179
/* Generated from spec:/rtems/basedefs/if/alloc-align */
180
190
#if defined(__GNUC__)
191
#define RTEMS_ALLOC_ALIGN( _index ) __attribute__(( __alloc_align__( _index ) ))
192
#else
193
#define RTEMS_ALLOC_ALIGN( _index )
194
#endif
195
196
/* Generated from spec:/rtems/basedefs/if/alloc-size */
197
206
#if defined(__GNUC__)
207
#define RTEMS_ALLOC_SIZE( _index ) __attribute__(( __alloc_size__( _index ) ))
208
#else
209
#define RTEMS_ALLOC_SIZE( _index )
210
#endif
211
212
/* Generated from spec:/rtems/basedefs/if/alloc-size-2 */
213
226
#if defined(__GNUC__)
227
#define RTEMS_ALLOC_SIZE_2( _count_index, _size_index ) \
228
__attribute__(( __alloc_size__( _count_index, _size_index ) ))
229
#else
230
#define RTEMS_ALLOC_SIZE_2( _count_index, _size_index )
231
#endif
232
233
/* Generated from spec:/rtems/basedefs/if/array-size */
234
244
#define RTEMS_ARRAY_SIZE( _array ) \
245
( sizeof( _array ) / sizeof( ( _array )[ 0 ] ) )
246
247
/* Generated from spec:/rtems/basedefs/if/compiler-memory-barrier */
248
255
#if defined(__GNUC__)
256
#define RTEMS_COMPILER_MEMORY_BARRIER() __asm__ volatile( "" ::: "memory" )
257
#else
258
#define RTEMS_COMPILER_MEMORY_BARRIER() do { } while ( 0 )
259
#endif
260
261
/* Generated from spec:/rtems/basedefs/if/concat */
262
274
#define RTEMS_CONCAT( _x, _y ) _x##_y
275
276
/* Generated from spec:/rtems/basedefs/if/const */
277
285
#if defined(__GNUC__)
286
#define RTEMS_CONST __attribute__(( __const__ ))
287
#else
288
#define RTEMS_CONST
289
#endif
290
291
/* Generated from spec:/rtems/basedefs/if/container-of */
292
306
#define RTEMS_CONTAINER_OF( _m, _type, _member_name ) \
307
( (_type *) ( (uintptr_t) ( _m ) - offsetof( _type, _member_name ) ) )
308
309
/* Generated from spec:/rtems/basedefs/if/declare-global-symbol */
310
321
#define RTEMS_DECLARE_GLOBAL_SYMBOL( _name ) extern char _name[]
322
323
/* Generated from spec:/rtems/basedefs/if/deprecated */
324
331
#if defined(__GNUC__)
332
#define RTEMS_DEPRECATED __attribute__(( __deprecated__ ))
333
#else
334
#define RTEMS_DEPRECATED
335
#endif
336
337
/* Generated from spec:/rtems/basedefs/if/compiler-deprecated-attribute */
338
344
#define RTEMS_COMPILER_DEPRECATED_ATTRIBUTE RTEMS_DEPRECATED
345
346
/* Generated from spec:/rtems/basedefs/if/expand */
347
355
#define RTEMS_EXPAND( _token ) _token
356
357
/* Generated from spec:/rtems/basedefs/if/function-name */
358
365
#if defined(__cplusplus) && defined(__GNUC__)
366
#define RTEMS_FUNCTION_NAME __PRETTY_FUNCTION__
367
#else
368
#define RTEMS_FUNCTION_NAME __func__
369
#endif
370
371
/* Generated from spec:/rtems/basedefs/if/no-return */
372
379
#if defined( __cplusplus ) && __cplusplus >= 201103L
380
#define RTEMS_NO_RETURN [[noreturn]]
381
#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 201112L
382
#define RTEMS_NO_RETURN _Noreturn
383
#elif defined(__GNUC__)
384
#define RTEMS_NO_RETURN __attribute__(( __noreturn__ ))
385
#else
386
#define RTEMS_NO_RETURN
387
#endif
388
389
/* Generated from spec:/rtems/basedefs/if/compiler-no-return-attribute */
390
396
#define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE RTEMS_NO_RETURN
397
398
/* Generated from spec:/rtems/basedefs/if/section */
399
408
#if defined(__GNUC__)
409
#define RTEMS_SECTION( _section ) __attribute__(( __section__( _section ) ))
410
#else
411
#define RTEMS_SECTION( _section )
412
#endif
413
414
/* Generated from spec:/rtems/basedefs/if/string */
415
426
#define RTEMS_STRING( ... ) #__VA_ARGS__
427
428
/* Generated from spec:/rtems/basedefs/if/typeof-refx */
429
444
#if defined(__GNUC__)
445
#define RTEMS_TYPEOF_REFX( _level, _target ) \
446
__typeof__( _level( union { int _z; __typeof__( _target ) _x; } ){ 0 }._x )
447
#else
448
#define RTEMS_TYPEOF_REFX( _level, _target )
449
#endif
450
451
/* Generated from spec:/rtems/basedefs/if/xconcat */
452
466
#define RTEMS_XCONCAT( _x, _y ) RTEMS_CONCAT( _x, _y )
467
468
#if !defined(ASM) && defined(RTEMS_DEBUG)
469
/* Generated from spec:/score/basedefs/if/debug-unreachable */
470
482
RTEMS_NO_RETURN
void
_Debug_Unreachable(
483
const
char
*file,
484
int
line,
485
const
char
*func
486
);
487
#endif
488
489
#if !defined(ASM)
490
/* Generated from spec:/score/basedefs/if/dequalify-types-not-compatible */
491
498
#if defined(__GNUC__)
499
__attribute__
((__error__(
"RTEMS_DEQUALIFY() types differ not only by volatile and const"
))) void *
500
RTEMS_DEQUALIFY_types_not_compatible
(
void
);
501
#else
502
void
*
RTEMS_DEQUALIFY_types_not_compatible
(
void
);
503
#endif
504
#endif
505
506
/* Generated from spec:/rtems/basedefs/if/dequalify-depthx */
507
520
#if defined(__cplusplus)
521
#define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
522
( const_cast<_type>( _var ) )
523
#elif defined(__GNUC__)
524
#define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
525
__builtin_choose_expr( \
526
__builtin_types_compatible_p( \
527
RTEMS_TYPEOF_REFX( _ptr_level, _var ), \
528
RTEMS_TYPEOF_REFX( _ptr_level, _type ) \
529
) || \
530
__builtin_types_compatible_p( \
531
_type, \
532
void * \
533
), \
534
(_type) ( _var ), \
535
RTEMS_DEQUALIFY_types_not_compatible() \
536
)
537
#else
538
#define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
539
( (_type) (uintptr_t) (const volatile void *)( _var ) )
540
#endif
541
542
/* Generated from spec:/rtems/basedefs/if/deconst */
543
554
#define RTEMS_DECONST( _type, _var ) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var )
555
556
/* Generated from spec:/rtems/basedefs/if/dequalify */
557
568
#define RTEMS_DEQUALIFY( _type, _var ) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var )
569
570
/* Generated from spec:/rtems/basedefs/if/devolatile */
571
582
#define RTEMS_DEVOLATILE( _type, _var ) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var )
583
584
#if !defined(FALSE)
585
/* Generated from spec:/rtems/basedefs/if/false */
586
592
#define FALSE 0
593
#endif
594
595
/* Generated from spec:/rtems/basedefs/if/have-member-same-type */
596
613
#if defined(__GNUC__)
614
#define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) \
615
__builtin_types_compatible_p( \
616
__typeof__( ( (_t_lhs *) 0 )->_m_lhs ), \
617
__typeof__( ( (_t_rhs *) 0 )->_m_rhs ) \
618
)
619
#else
620
#define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) true
621
#endif
622
623
/* Generated from spec:/rtems/basedefs/if/inline-routine */
624
631
#if defined(__GNUC__)
632
#define RTEMS_INLINE_ROUTINE static __inline__
633
#else
634
#define RTEMS_INLINE_ROUTINE static inline
635
#endif
636
637
/* Generated from spec:/rtems/basedefs/if/malloclike */
638
645
#if defined(__GNUC__)
646
#define RTEMS_MALLOCLIKE __attribute__(( __malloc__ ))
647
#else
648
#define RTEMS_MALLOCLIKE
649
#endif
650
651
/* Generated from spec:/rtems/basedefs/if/no-inline */
652
659
#if defined(__GNUC__)
660
#define RTEMS_NO_INLINE __attribute__(( __noinline__ ))
661
#else
662
#define RTEMS_NO_INLINE
663
#endif
664
665
/* Generated from spec:/rtems/basedefs/if/noinit */
666
673
#define RTEMS_NOINIT RTEMS_SECTION( ".noinit" )
674
675
/* Generated from spec:/rtems/basedefs/if/obfuscate-variable */
676
687
#if defined(__GNUC__)
688
#define RTEMS_OBFUSCATE_VARIABLE( _var ) __asm__( "" : "+r" ( _var ) )
689
#else
690
#define RTEMS_OBFUSCATE_VARIABLE( _var ) (void) ( _var )
691
#endif
692
693
/* Generated from spec:/rtems/basedefs/if/packed */
694
701
#if defined(__GNUC__)
702
#define RTEMS_PACKED __attribute__(( __packed__ ))
703
#else
704
#define RTEMS_PACKED
705
#endif
706
707
/* Generated from spec:/rtems/basedefs/if/compiler-packed-attribute */
708
714
#define RTEMS_COMPILER_PACKED_ATTRIBUTE RTEMS_PACKED
715
716
/* Generated from spec:/rtems/basedefs/if/predict-false */
717
729
#if defined(__GNUC__)
730
#define RTEMS_PREDICT_FALSE( _exp ) __builtin_expect( ( _exp ), 0 )
731
#else
732
#define RTEMS_PREDICT_FALSE( _exp ) ( _exp )
733
#endif
734
735
/* Generated from spec:/rtems/basedefs/if/predict-true */
736
748
#if defined(__GNUC__)
749
#define RTEMS_PREDICT_TRUE( _exp ) __builtin_expect( ( _exp ), 1 )
750
#else
751
#define RTEMS_PREDICT_TRUE( _exp ) ( _exp )
752
#endif
753
754
/* Generated from spec:/rtems/basedefs/if/printflike */
755
768
#if defined(__GNUC__)
769
#define RTEMS_PRINTFLIKE( _format_pos, _ap_pos ) \
770
__attribute__(( __format__( __printf__, _format_pos, _ap_pos ) ))
771
#else
772
#define RTEMS_PRINTFLIKE( _format_pos, _ap_pos )
773
#endif
774
775
/* Generated from spec:/rtems/basedefs/if/pure */
776
784
#if defined(__GNUC__)
785
#define RTEMS_PURE __attribute__(( __pure__ ))
786
#else
787
#define RTEMS_PURE
788
#endif
789
790
/* Generated from spec:/rtems/basedefs/if/compiler-pure-attribute */
791
797
#define RTEMS_COMPILER_PURE_ATTRIBUTE RTEMS_PURE
798
799
/* Generated from spec:/rtems/basedefs/if/return-address */
800
808
#if defined(__GNUC__)
809
#define RTEMS_RETURN_ADDRESS() __builtin_return_address( 0 )
810
#else
811
#define RTEMS_RETURN_ADDRESS() NULL
812
#endif
813
814
/* Generated from spec:/rtems/basedefs/if/static-analysis */
815
821
#if defined(__COVERITY__)
822
#define RTEMS_STATIC_ANALYSIS
823
#endif
824
825
/* Generated from spec:/rtems/basedefs/if/static-assert */
826
836
#if defined( __cplusplus ) && __cplusplus >= 201103L
837
#define RTEMS_STATIC_ASSERT( _cond, _msg ) static_assert( _cond, # _msg )
838
#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 201112L
839
#define RTEMS_STATIC_ASSERT( _cond, _msg ) _Static_assert( _cond, # _msg )
840
#else
841
#define RTEMS_STATIC_ASSERT( _cond, _msg ) \
842
struct rtems_static_assert_ ## _msg \
843
{ int rtems_static_assert_ ## _msg : ( _cond ) ? 1 : -1; }
844
#endif
845
846
/* Generated from spec:/rtems/basedefs/if/symbol-name */
847
858
#if defined(__USER_LABEL_PREFIX__)
859
#define RTEMS_SYMBOL_NAME( _name ) RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name )
860
#else
861
#define RTEMS_SYMBOL_NAME( _name ) RTEMS_EXPAND( _name )
862
#endif
863
864
#if !defined(TRUE)
865
/* Generated from spec:/rtems/basedefs/if/true */
866
872
#define TRUE 1
873
#endif
874
875
/* Generated from spec:/rtems/basedefs/if/unreachable */
876
882
#if defined(RTEMS_DEBUG)
883
#define RTEMS_UNREACHABLE() \
884
_Debug_Unreachable( __FILE__, __LINE__, RTEMS_FUNCTION_NAME )
885
#elif defined(__GNUC__)
886
#define RTEMS_UNREACHABLE() __builtin_unreachable()
887
#else
888
#define RTEMS_UNREACHABLE() do { } while ( 0 )
889
#endif
890
891
/* Generated from spec:/rtems/basedefs/if/unused */
892
899
#if defined(__GNUC__)
900
#define RTEMS_UNUSED __attribute__(( __unused__ ))
901
#else
902
#define RTEMS_UNUSED
903
#endif
904
905
/* Generated from spec:/rtems/basedefs/if/compiler-unused-attribute */
906
912
#define RTEMS_COMPILER_UNUSED_ATTRIBUTE RTEMS_UNUSED
913
914
/* Generated from spec:/rtems/basedefs/if/used */
915
921
#if defined(__GNUC__)
922
#define RTEMS_USED __attribute__(( __used__ ))
923
#else
924
#define RTEMS_USED
925
#endif
926
927
/* Generated from spec:/rtems/basedefs/if/warn-unused-result */
928
935
#if defined(__GNUC__)
936
#define RTEMS_WARN_UNUSED_RESULT __attribute__(( __warn_unused_result__ ))
937
#else
938
#define RTEMS_WARN_UNUSED_RESULT
939
#endif
940
941
/* Generated from spec:/rtems/basedefs/if/weak */
942
952
#if defined(__GNUC__)
953
#define RTEMS_WEAK __attribute__(( __weak__ ))
954
#else
955
#define RTEMS_WEAK
956
#endif
957
958
/* Generated from spec:/rtems/basedefs/if/weak-alias */
959
968
#if defined(__GNUC__)
969
#define RTEMS_WEAK_ALIAS( _target ) \
970
__attribute__(( __weak__, __alias__( #_target ) ))
971
#else
972
#define RTEMS_WEAK_ALIAS( _target )
973
#endif
974
975
/* Generated from spec:/rtems/basedefs/if/xstring */
976
987
#define RTEMS_XSTRING( ... ) RTEMS_STRING( __VA_ARGS__ )
988
989
/* Generated from spec:/rtems/basedefs/if/define-global-symbol */
990
1007
#if defined(__GNUC__)
1008
#define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) \
1009
__asm__( \
1010
"\t.globl " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
1011
"\n\t.set " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
1012
", " RTEMS_STRING( _value ) "\n" \
1013
)
1014
#else
1015
#define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value )
1016
#endif
1017
1018
/* Generated from spec:/rtems/basedefs/if/zero-length-array */
1019
1029
#if __STDC_VERSION__ >= 199409L
1030
#define RTEMS_ZERO_LENGTH_ARRAY
1031
#else
1032
#define RTEMS_ZERO_LENGTH_ARRAY 0
1033
#endif
1034
1035
#ifdef __cplusplus
1036
}
1037
#endif
1038
1039
#endif
/* _RTEMS_SCORE_BASEDEFS_H */
RTEMS_NO_RETURN
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition
basedefs.h:386
RTEMS_DEQUALIFY_types_not_compatible
void * RTEMS_DEQUALIFY_types_not_compatible(void)
A not implemented function to trigger compile time errors with an error message.
__attribute__
Definition
xnandpsu_onfi.h:185
Generated by
1.18.0