5 * Doxygen can't cope with some of the more esoteric areas of C, so we
6 * make its life simpler.
10 #define __attribute__(x)
15 * Global compiler definitions.
17 * This file is implicitly included by every @c .c file in Etherboot.
18 * It defines global macros such as DBG().
20 * We arrange for each object to export the symbol @c obj_OBJECT
21 * (where @c OBJECT is the object name, e.g. @c rtl8139) as a global
22 * symbol, so that the linker can drag in selected object files from
23 * the library using <tt> -u obj_OBJECT </tt>.
27 /* Force visibility of all symbols to "hidden", i.e. inform gcc that
28 * all symbol references resolve strictly within our final binary.
29 * This avoids unnecessary PLT/GOT entries on x86_64.
31 * This is a stronger claim than specifying "-fvisibility=hidden",
32 * since it also affects symbols marked with "extern".
36 #pragma GCC visibility push(hidden)
45 /** Concatenate non-expanded arguments */
46 #define _C1( x, y ) x ## y
47 /** Concatenate expanded arguments */
48 #define _C2( x, y ) _C1 ( x, y )
50 /** Stringify non-expanded argument */
52 /** Stringify expanded argument */
53 #define _S2( x ) _S1 ( x )
56 * @defgroup symmacros Macros to provide or require explicit symbols
60 /** Provide a symbol within this object file */
62 #define PROVIDE_SYMBOL( _sym ) \
63 .section ".provided", "a", @nobits ; \
69 #define PROVIDE_SYMBOL( _sym ) \
71 __attribute__ (( section ( ".provided" ) ))
74 /** Require a symbol within this object file
76 * The symbol is referenced by a relocation in a discarded section, so
77 * if it is not available at link time the link will fail.
80 #define REQUIRE_SYMBOL( _sym ) \
81 .section ".discard", "a", @progbits ; \
86 #define REQUIRE_SYMBOL( _sym ) \
88 static char * _C2 ( _C2 ( __require_, _sym ), _C2 ( _, __LINE__ ) ) \
89 __attribute__ (( section ( ".discard" ), used )) \
93 /** Request that a symbol be available at runtime
95 * The requested symbol is entered as undefined into the symbol table
96 * for this object, so the linker will pull in other object files as
97 * necessary to satisfy the reference. However, the undefined symbol
98 * is not referenced in any relocations, so the link can still succeed
99 * if no file contains it.
101 * A symbol passed to this macro may not be referenced anywhere
102 * else in the file. If you want to do that, see IMPORT_SYMBOL().
105 #define REQUEST_SYMBOL( _sym ) \
106 .equ __need_ ## _sym, _sym
108 #define REQUEST_SYMBOL( _sym ) \
109 __asm__ ( ".equ\t__need_" #_sym ", " #_sym )
110 #endif /* ASSEMBLY */
112 /** Set up a symbol to be usable in another file by IMPORT_SYMBOL()
114 * The symbol must already be marked as global.
116 #define EXPORT_SYMBOL( _sym ) PROVIDE_SYMBOL ( __export_ ## _sym )
118 /** Make a symbol usable to this file if available at link time
120 * If no file passed to the linker contains the symbol, it will have
121 * @c NULL value to future uses. Keep in mind that the symbol value is
122 * really the @e address of a variable or function; see the code
125 * In C using IMPORT_SYMBOL, you must specify the declaration as the
126 * second argument, for instance
129 * IMPORT_SYMBOL ( my_func, int my_func ( int arg ) );
130 * IMPORT_SYMBOL ( my_var, int my_var );
132 * void use_imports ( void ) {
133 * if ( my_func && &my_var )
134 * my_var = my_func ( my_var );
138 * GCC considers a weak declaration to override a strong one no matter
139 * which comes first, so it is safe to include a header file declaring
140 * the imported symbol normally, but providing the declaration to
141 * IMPORT_SYMBOL is still required.
143 * If no EXPORT_SYMBOL declaration exists for the imported symbol in
144 * another file, the behavior will be most likely be identical to that
145 * for an unavailable symbol.
148 #define IMPORT_SYMBOL( _sym ) \
149 REQUEST_SYMBOL ( __export_ ## _sym ) ; \
152 #define IMPORT_SYMBOL( _sym, _decl ) \
153 REQUEST_SYMBOL ( __export_ ## _sym ) ; \
154 extern _decl __attribute__ (( weak ))
160 * @defgroup objmacros Macros to provide or require explicit objects
164 #define PREFIX_OBJECT( _prefix ) _C2 ( _prefix, OBJECT )
165 #define OBJECT_SYMBOL PREFIX_OBJECT ( obj_ )
166 #define REQUEST_EXPANDED( _sym ) REQUEST_SYMBOL ( _sym )
167 #define CONFIG_SYMBOL PREFIX_OBJECT ( obj_config_ )
169 /** Always provide the symbol for the current object (defined by -DOBJECT) */
170 PROVIDE_SYMBOL ( OBJECT_SYMBOL );
172 /** Pull in an object-specific configuration file if available */
173 REQUEST_EXPANDED ( CONFIG_SYMBOL );
175 /** Explicitly require another object */
176 #define REQUIRE_OBJECT( _obj ) REQUIRE_SYMBOL ( obj_ ## _obj )
178 /** Pull in another object if it exists */
179 #define REQUEST_OBJECT( _obj ) REQUEST_SYMBOL ( obj_ ## _obj )
183 /** Select file identifier for errno.h (if used) */
184 #define ERRFILE PREFIX_OBJECT ( ERRFILE_ )
188 /** Declare a function as weak (use *before* the definition)
190 * Due to a bug in at least GCC 4.4.4 and earlier, weak symbols may be
191 * inlined if they have hidden visibility (see above for why hidden
192 * visibility is used). This results in the non-weak symbol never
193 * being used, so explicitly mark the function as noinline to prevent
196 #define __weak __attribute__ (( weak, noinline ))
198 /** Prevent a function from being optimized away without inlining
200 * Calls to functions with void return type that contain no code in their body
201 * may be removed by gcc's optimizer even when inlining is inhibited. Placing
202 * this macro in the body of the function prevents that from occurring.
204 #define __keepme asm("");
208 /** @defgroup dbg Debugging infrastructure
214 * Print a debugging message.
216 * The debug level is set at build time by specifying the @c DEBUG=
217 * parameter on the @c make command line. For example, to enable
218 * debugging for the PCI bus functions (in pci.c) in a @c .dsk image
219 * for the @c rtl8139 card, you could use the command line
223 * make bin/rtl8139.dsk DEBUG=pci
227 * This will enable the debugging statements (DBG()) in pci.c. If
228 * debugging is not enabled, DBG() statements will be ignored.
230 * You can enable debugging in several objects simultaneously by
231 * separating them with commas, as in
235 * make bin/rtl8139.dsk DEBUG=pci,buffer,heap
239 * You can increase the debugging level for an object by specifying it
240 * with @c :N, where @c N is the level, as in
244 * make bin/rtl8139.dsk DEBUG=pci,buffer:2,heap
248 * which would enable debugging for the PCI, buffer-handling and
249 * heap-allocation code, with the buffer-handling code at level 2.
260 /** printf() for debugging */
261 extern void __attribute__ (( format ( printf, 1, 2 ) ))
262 dbg_printf ( const char *fmt, ... );
263 extern void dbg_autocolourise ( unsigned long id );
264 extern void dbg_decolourise ( void );
265 extern void dbg_hex_dump_da ( unsigned long dispaddr,
266 const void *data, unsigned long len );
267 extern void dbg_md5_da ( unsigned long dispaddr,
268 const void *data, unsigned long len );
269 extern void dbg_pause ( void );
270 extern void dbg_more ( void );
272 /* Allow for selective disabling of enabled debug levels */
275 #define DBGLVL ( DBGLVL_MAX & ~__debug_disable )
276 #define DBG_DISABLE( level ) do { \
277 __debug_disable |= (level); \
279 #define DBG_ENABLE( level ) do { \
280 __debug_disable &= ~(level); \
284 #define DBG_DISABLE( level ) do { } while ( 0 )
285 #define DBG_ENABLE( level ) do { } while ( 0 )
289 #define DBG_LOG ( DBGLVL & DBGLVL_LOG )
290 #define DBGLVL_EXTRA 2
291 #define DBG_EXTRA ( DBGLVL & DBGLVL_EXTRA )
292 #define DBGLVL_PROFILE 4
293 #define DBG_PROFILE ( DBGLVL & DBGLVL_PROFILE )
295 #define DBG_IO ( DBGLVL & DBGLVL_IO )
298 * Print debugging message if we are at a certain debug level
300 * @v level Debug level
301 * @v ... printf() argument list
303 #define DBG_IF( level, ... ) do { \
304 if ( DBG_ ## level ) { \
305 dbg_printf ( __VA_ARGS__ ); \
310 * Print a hex dump if we are at a certain debug level
312 * @v level Debug level
313 * @v dispaddr Display address
314 * @v data Data to print
315 * @v len Length of data
317 #define DBG_HDA_IF( level, dispaddr, data, len ) do { \
318 if ( DBG_ ## level ) { \
321 typeof ( dispaddr ) raw; \
325 dbg_hex_dump_da ( da.ul, data, len ); \
330 * Print a hex dump if we are at a certain debug level
332 * @v level Debug level
333 * @v data Data to print
334 * @v len Length of data
336 #define DBG_HD_IF( level, data, len ) do { \
337 const void *_data = data; \
338 DBG_HDA_IF ( level, _data, _data, len ); \
342 * Print an MD5 checksum if we are at a certain debug level
344 * @v level Debug level
345 * @v dispaddr Display address
346 * @v data Data to print
347 * @v len Length of data
349 #define DBG_MD5A_IF( level, dispaddr, data, len ) do { \
350 if ( DBG_ ## level ) { \
353 typeof ( dispaddr ) raw; \
357 dbg_md5_da ( da.ul, data, len ); \
362 * Print an MD5 checksum if we are at a certain debug level
364 * @v level Debug level
365 * @v data Data to print
366 * @v len Length of data
368 #define DBG_MD5_IF( level, data, len ) do { \
369 const void *_data = data; \
370 DBG_MD5A_IF ( level, _data, _data, len ); \
374 * Prompt for key press if we are at a certain debug level
376 * @v level Debug level
378 #define DBG_PAUSE_IF( level ) do { \
379 if ( DBG_ ## level ) { \
385 * Prompt for more output data if we are at a certain debug level
387 * @v level Debug level
389 #define DBG_MORE_IF( level ) do { \
390 if ( DBG_ ## level ) { \
396 * Select colour for debug messages if we are at a certain debug level
398 * @v level Debug level
399 * @v id Message stream ID
401 #define DBG_AC_IF( level, id ) do { \
402 if ( DBG_ ## level ) { \
408 dbg_stream.raw = id; \
409 dbg_autocolourise ( dbg_stream.ul ); \
414 * Revert colour for debug messages if we are at a certain debug level
416 * @v level Debug level
418 #define DBG_DC_IF( level ) do { \
419 if ( DBG_ ## level ) { \
424 /* Autocolourising versions of the DBGxxx_IF() macros */
426 #define DBGC_IF( level, id, ... ) do { \
427 DBG_AC_IF ( level, id ); \
428 DBG_IF ( level, __VA_ARGS__ ); \
429 DBG_DC_IF ( level ); \
432 #define DBGC_HDA_IF( level, id, ... ) do { \
433 DBG_AC_IF ( level, id ); \
434 DBG_HDA_IF ( level, __VA_ARGS__ ); \
435 DBG_DC_IF ( level ); \
438 #define DBGC_HD_IF( level, id, ... ) do { \
439 DBG_AC_IF ( level, id ); \
440 DBG_HD_IF ( level, __VA_ARGS__ ); \
441 DBG_DC_IF ( level ); \
444 #define DBGC_MD5A_IF( level, id, ... ) do { \
445 DBG_AC_IF ( level, id ); \
446 DBG_MD5A_IF ( level, __VA_ARGS__ ); \
447 DBG_DC_IF ( level ); \
450 #define DBGC_MD5_IF( level, id, ... ) do { \
451 DBG_AC_IF ( level, id ); \
452 DBG_MD5_IF ( level, __VA_ARGS__ ); \
453 DBG_DC_IF ( level ); \
456 #define DBGC_PAUSE_IF( level, id ) do { \
457 DBG_AC_IF ( level, id ); \
458 DBG_PAUSE_IF ( level ); \
459 DBG_DC_IF ( level ); \
462 #define DBGC_MORE_IF( level, id ) do { \
463 DBG_AC_IF ( level, id ); \
464 DBG_MORE_IF ( level ); \
465 DBG_DC_IF ( level ); \
468 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( LOG, ... )*/
470 #define DBG( ... ) DBG_IF ( LOG, ##__VA_ARGS__ )
471 #define DBG_HDA( ... ) DBG_HDA_IF ( LOG, ##__VA_ARGS__ )
472 #define DBG_HD( ... ) DBG_HD_IF ( LOG, ##__VA_ARGS__ )
473 #define DBG_MD5A( ... ) DBG_MD5A_IF ( LOG, ##__VA_ARGS__ )
474 #define DBG_MD5( ... ) DBG_MD5_IF ( LOG, ##__VA_ARGS__ )
475 #define DBG_PAUSE( ... ) DBG_PAUSE_IF ( LOG, ##__VA_ARGS__ )
476 #define DBG_MORE( ... ) DBG_MORE_IF ( LOG, ##__VA_ARGS__ )
477 #define DBGC( ... ) DBGC_IF ( LOG, ##__VA_ARGS__ )
478 #define DBGC_HDA( ... ) DBGC_HDA_IF ( LOG, ##__VA_ARGS__ )
479 #define DBGC_HD( ... ) DBGC_HD_IF ( LOG, ##__VA_ARGS__ )
480 #define DBGC_MD5A( ... ) DBGC_MD5A_IF ( LOG, ##__VA_ARGS__ )
481 #define DBGC_MD5( ... ) DBGC_MD5_IF ( LOG, ##__VA_ARGS__ )
482 #define DBGC_PAUSE( ... ) DBGC_PAUSE_IF ( LOG, ##__VA_ARGS__ )
483 #define DBGC_MORE( ... ) DBGC_MORE_IF ( LOG, ##__VA_ARGS__ )
485 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( EXTRA, ... )*/
487 #define DBG2( ... ) DBG_IF ( EXTRA, ##__VA_ARGS__ )
488 #define DBG2_HDA( ... ) DBG_HDA_IF ( EXTRA, ##__VA_ARGS__ )
489 #define DBG2_HD( ... ) DBG_HD_IF ( EXTRA, ##__VA_ARGS__ )
490 #define DBG2_MD5A( ... ) DBG_MD5A_IF ( EXTRA, ##__VA_ARGS__ )
491 #define DBG2_MD5( ... ) DBG_MD5_IF ( EXTRA, ##__VA_ARGS__ )
492 #define DBG2_PAUSE( ... ) DBG_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
493 #define DBG2_MORE( ... ) DBG_MORE_IF ( EXTRA, ##__VA_ARGS__ )
494 #define DBGC2( ... ) DBGC_IF ( EXTRA, ##__VA_ARGS__ )
495 #define DBGC2_HDA( ... ) DBGC_HDA_IF ( EXTRA, ##__VA_ARGS__ )
496 #define DBGC2_HD( ... ) DBGC_HD_IF ( EXTRA, ##__VA_ARGS__ )
497 #define DBGC2_MD5A( ... ) DBGC_MD5A_IF ( EXTRA, ##__VA_ARGS__ )
498 #define DBGC2_MD5( ... ) DBGC_MD5_IF ( EXTRA, ##__VA_ARGS__ )
499 #define DBGC2_PAUSE( ... ) DBGC_PAUSE_IF ( EXTRA, ##__VA_ARGS__ )
500 #define DBGC2_MORE( ... ) DBGC_MORE_IF ( EXTRA, ##__VA_ARGS__ )
502 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( PROFILE, ... )*/
504 #define DBGP( ... ) DBG_IF ( PROFILE, ##__VA_ARGS__ )
505 #define DBGP_HDA( ... ) DBG_HDA_IF ( PROFILE, ##__VA_ARGS__ )
506 #define DBGP_HD( ... ) DBG_HD_IF ( PROFILE, ##__VA_ARGS__ )
507 #define DBGP_MD5A( ... ) DBG_MD5A_IF ( PROFILE, ##__VA_ARGS__ )
508 #define DBGP_MD5( ... ) DBG_MD5_IF ( PROFILE, ##__VA_ARGS__ )
509 #define DBGP_PAUSE( ... ) DBG_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
510 #define DBGP_MORE( ... ) DBG_MORE_IF ( PROFILE, ##__VA_ARGS__ )
511 #define DBGCP( ... ) DBGC_IF ( PROFILE, ##__VA_ARGS__ )
512 #define DBGCP_HDA( ... ) DBGC_HDA_IF ( PROFILE, ##__VA_ARGS__ )
513 #define DBGCP_HD( ... ) DBGC_HD_IF ( PROFILE, ##__VA_ARGS__ )
514 #define DBGCP_MD5A( ... ) DBGC_MD5A_IF ( PROFILE, ##__VA_ARGS__ )
515 #define DBGCP_MD5( ... ) DBGC_MD5_IF ( PROFILE, ##__VA_ARGS__ )
516 #define DBGCP_PAUSE( ... ) DBGC_PAUSE_IF ( PROFILE, ##__VA_ARGS__ )
517 #define DBGCP_MORE( ... ) DBGC_MORE_IF ( PROFILE, ##__VA_ARGS__ )
519 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( IO, ... )*/
521 #define DBGIO( ... ) DBG_IF ( IO, ##__VA_ARGS__ )
522 #define DBGIO_HDA( ... ) DBG_HDA_IF ( IO, ##__VA_ARGS__ )
523 #define DBGIO_HD( ... ) DBG_HD_IF ( IO, ##__VA_ARGS__ )
524 #define DBGIO_MD5A( ... ) DBG_MD5A_IF ( IO, ##__VA_ARGS__ )
525 #define DBGIO_MD5( ... ) DBG_MD5_IF ( IO, ##__VA_ARGS__ )
526 #define DBGIO_PAUSE( ... ) DBG_PAUSE_IF ( IO, ##__VA_ARGS__ )
527 #define DBGIO_MORE( ... ) DBG_MORE_IF ( IO, ##__VA_ARGS__ )
528 #define DBGCIO( ... ) DBGC_IF ( IO, ##__VA_ARGS__ )
529 #define DBGCIO_HDA( ... ) DBGC_HDA_IF ( IO, ##__VA_ARGS__ )
530 #define DBGCIO_HD( ... ) DBGC_HD_IF ( IO, ##__VA_ARGS__ )
531 #define DBGCIO_MD5A( ... ) DBGC_MD5A_IF ( IO, ##__VA_ARGS__ )
532 #define DBGCIO_MD5( ... ) DBGC_MD5_IF ( IO, ##__VA_ARGS__ )
533 #define DBGCIO_PAUSE( ... ) DBGC_PAUSE_IF ( IO, ##__VA_ARGS__ )
534 #define DBGCIO_MORE( ... ) DBGC_MORE_IF ( IO, ##__VA_ARGS__ )
536 #endif /* ASSEMBLY */
539 /** @defgroup attrs Miscellaneous attributes
544 /** Declare a variable or data structure as unused. */
545 #define __unused __attribute__ (( unused ))
548 * Declare a function as pure - i.e. without side effects
550 #define __pure __attribute__ (( pure ))
553 * Declare a function as const - i.e. it does not access global memory
554 * (including dereferencing pointers passed to it) at all.
555 * Must also not call any non-const functions.
557 #define __const __attribute__ (( const ))
560 * Declare a function's pointer parameters as non-null - i.e. force
561 * compiler to check pointers at compile time and enable possible
562 * optimizations based on that fact
564 #define __nonnull __attribute__ (( nonnull ))
567 * Declare a pointer returned by a function as a unique memory address
568 * as returned by malloc-type functions.
570 #define __malloc __attribute__ (( malloc ))
573 * Declare a function as used.
575 * Necessary only if the function is called only from assembler code.
577 #define __used __attribute__ (( used ))
579 /** Declare a data structure to be aligned with 16-byte alignment */
580 #define __aligned __attribute__ (( aligned ( 16 ) ))
582 /** Declare a function to be always inline */
583 #define __always_inline __attribute__ (( always_inline ))
585 /* Force all inline functions to not be instrumented
587 * This is required to cope with what seems to be a long-standing gcc
588 * bug, in which -finstrument-functions will cause instances of
589 * inlined functions to be reported as further calls to the
590 * *containing* function. This makes instrumentation very difficult
593 * Work around this problem by adding the no_instrument_function
594 * attribute to all inlined functions.
596 #define inline inline __attribute__ (( no_instrument_function ))
601 * To save space in the binary when multiple-driver images are
602 * compiled, uninitialised data areas can be shared between drivers.
603 * This will typically be used to share statically-allocated receive
604 * and transmit buffers between drivers.
611 * char rx_buf[NUM_RX_BUF][RX_BUF_SIZE];
612 * char tx_buf[TX_BUF_SIZE];
613 * } my_static_data __shared;
618 #define __shared __asm__ ( "_shared_bss" ) __aligned
620 #endif /* ASSEMBLY */
624 * Optimisation barrier
627 #define barrier() __asm__ __volatile__ ( "" : : : "memory" )
628 #endif /* ASSEMBLY */
631 * @defgroup licences Licence declarations
633 * For reasons that are partly historical, various different files
634 * within the iPXE codebase have differing licences.
639 /** Declare a file as being in the public domain
641 * This licence declaration is applicable when a file states itself to
642 * be in the public domain.
644 #define FILE_LICENCE_PUBLIC_DOMAIN \
645 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__public_domain__ ) )
647 /** Declare a file as being under version 2 (or later) of the GNU GPL
649 * This licence declaration is applicable when a file states itself to
650 * be licensed under the GNU GPL; "either version 2 of the License, or
651 * (at your option) any later version".
653 #define FILE_LICENCE_GPL2_OR_LATER \
654 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_or_later__ ) )
656 /** Declare a file as being under version 2 of the GNU GPL
658 * This licence declaration is applicable when a file states itself to
659 * be licensed under version 2 of the GPL, and does not include the
660 * "or, at your option, any later version" clause.
662 #define FILE_LICENCE_GPL2_ONLY \
663 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl2_only__ ) )
665 /** Declare a file as being under any version of the GNU GPL
667 * This licence declaration is applicable when a file states itself to
668 * be licensed under the GPL, but does not specify a version.
670 * According to section 9 of the GPLv2, "If the Program does not
671 * specify a version number of this License, you may choose any
672 * version ever published by the Free Software Foundation".
674 #define FILE_LICENCE_GPL_ANY \
675 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__gpl_any__ ) )
677 /** Declare a file as being under the three-clause BSD licence
679 * This licence declaration is applicable when a file states itself to
680 * be licensed under terms allowing redistribution in source and
681 * binary forms (with or without modification) provided that:
683 * redistributions of source code retain the copyright notice,
684 * list of conditions and any attached disclaimers
686 * redistributions in binary form reproduce the copyright notice,
687 * list of conditions and any attached disclaimers in the
688 * documentation and/or other materials provided with the
691 * the name of the author is not used to endorse or promote
692 * products derived from the software without specific prior
695 * It is not necessary for the file to explicitly state that it is
696 * under a "BSD" licence; only that the licensing terms be
697 * functionally equivalent to the standard three-clause BSD licence.
699 #define FILE_LICENCE_BSD3 \
700 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd3__ ) )
702 /** Declare a file as being under the two-clause BSD licence
704 * This licence declaration is applicable when a file states itself to
705 * be licensed under terms allowing redistribution in source and
706 * binary forms (with or without modification) provided that:
708 * redistributions of source code retain the copyright notice,
709 * list of conditions and any attached disclaimers
711 * redistributions in binary form reproduce the copyright notice,
712 * list of conditions and any attached disclaimers in the
713 * documentation and/or other materials provided with the
716 * It is not necessary for the file to explicitly state that it is
717 * under a "BSD" licence; only that the licensing terms be
718 * functionally equivalent to the standard two-clause BSD licence.
720 #define FILE_LICENCE_BSD2 \
721 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd2__ ) )
723 /** Declare a file as being under the one-clause MIT-style licence
725 * This licence declaration is applicable when a file states itself to
726 * be licensed under terms allowing redistribution for any purpose
727 * with or without fee, provided that the copyright notice and
728 * permission notice appear in all copies.
730 #define FILE_LICENCE_MIT \
731 PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__mit__ ) )
733 /** Declare a particular licence as applying to a file */
734 #define FILE_LICENCE( _licence ) FILE_LICENCE_ ## _licence
738 /* This file itself is under GPLv2-or-later */
739 FILE_LICENCE ( GPL2_OR_LATER );
741 #include <bits/compiler.h>
743 #endif /* COMPILER_H */