00001 #ifndef COMPILER_H 00002 #define COMPILER_H 00003 00004 /* 00005 * Doxygen can't cope with some of the more esoteric areas of C, so we 00006 * make its life simpler. 00007 * 00008 */ 00009 #ifdef DOXYGEN 00010 #define __attribute__(x) 00011 #endif 00012 00013 /** @file 00014 * 00015 * Global compiler definitions. 00016 * 00017 * This file is implicitly included by every @c .c file in Etherboot. 00018 * It defines global macros such as DBG(). 00019 * 00020 * We arrange for each object to export the symbol @c obj_OBJECT 00021 * (where @c OBJECT is the object name, e.g. @c rtl8139) as a global 00022 * symbol, so that the linker can drag in selected object files from 00023 * the library using <tt> -u obj_OBJECT </tt>. 00024 * 00025 */ 00026 00027 /* Force visibility of all symbols to "hidden", i.e. inform gcc that 00028 * all symbol references resolve strictly within our final binary. 00029 * This avoids unnecessary PLT/GOT entries on x86_64. 00030 * 00031 * This is a stronger claim than specifying "-fvisibility=hidden", 00032 * since it also affects symbols marked with "extern". 00033 */ 00034 #ifndef ASSEMBLY 00035 #if __GNUC__ >= 4 00036 #pragma GCC visibility push(hidden) 00037 #endif 00038 #endif /* ASSEMBLY */ 00039 00040 #undef _S1 00041 #undef _S2 00042 #undef _C1 00043 #undef _C2 00044 00045 /** Concatenate non-expanded arguments */ 00046 #define _C1( x, y ) x ## y 00047 /** Concatenate expanded arguments */ 00048 #define _C2( x, y ) _C1 ( x, y ) 00049 00050 /** Stringify non-expanded argument */ 00051 #define _S1( x ) #x 00052 /** Stringify expanded argument */ 00053 #define _S2( x ) _S1 ( x ) 00054 00055 /** 00056 * @defgroup symmacros Macros to provide or require explicit symbols 00057 * @{ 00058 */ 00059 00060 /** Provide a symbol within this object file */ 00061 #ifdef ASSEMBLY 00062 #define PROVIDE_SYMBOL( _sym ) \ 00063 .globl _sym ; \ 00064 .comm _sym, 0 00065 #else /* ASSEMBLY */ 00066 #define PROVIDE_SYMBOL( _sym ) \ 00067 char _sym[0] 00068 #endif /* ASSEMBLY */ 00069 00070 /** Require a symbol within this object file 00071 * 00072 * The symbol is referenced by a relocation in a discarded section, so 00073 * if it is not available at link time the link will fail. 00074 */ 00075 #ifdef ASSEMBLY 00076 #define REQUIRE_SYMBOL( _sym ) \ 00077 .section ".discard", "a", @progbits ; \ 00078 .extern _sym ; \ 00079 .long _sym ; \ 00080 .previous 00081 #else /* ASSEMBLY */ 00082 #define REQUIRE_SYMBOL( _sym ) \ 00083 extern char _sym; \ 00084 static char * _C2 ( _C2 ( __require_, _sym ), _C2 ( _, __LINE__ ) ) \ 00085 __attribute__ (( section ( ".discard" ), used )) \ 00086 = &_sym 00087 #endif 00088 00089 /** Request that a symbol be available at runtime 00090 * 00091 * The requested symbol is entered as undefined into the symbol table 00092 * for this object, so the linker will pull in other object files as 00093 * necessary to satisfy the reference. However, the undefined symbol 00094 * is not referenced in any relocations, so the link can still succeed 00095 * if no file contains it. 00096 * 00097 * A symbol passed to this macro may not be referenced anywhere 00098 * else in the file. If you want to do that, see IMPORT_SYMBOL(). 00099 */ 00100 #ifdef ASSEMBLY 00101 #define REQUEST_SYMBOL( _sym ) \ 00102 .equ __need_ ## _sym, _sym 00103 #else /* ASSEMBLY */ 00104 #define REQUEST_SYMBOL( _sym ) \ 00105 __asm__ ( ".equ\t__need_" #_sym ", " #_sym ) 00106 #endif /* ASSEMBLY */ 00107 00108 /** Set up a symbol to be usable in another file by IMPORT_SYMBOL() 00109 * 00110 * The symbol must already be marked as global. 00111 */ 00112 #define EXPORT_SYMBOL( _sym ) PROVIDE_SYMBOL ( __export_ ## _sym ) 00113 00114 /** Make a symbol usable to this file if available at link time 00115 * 00116 * If no file passed to the linker contains the symbol, it will have 00117 * @c NULL value to future uses. Keep in mind that the symbol value is 00118 * really the @e address of a variable or function; see the code 00119 * snippet below. 00120 * 00121 * In C using IMPORT_SYMBOL, you must specify the declaration as the 00122 * second argument, for instance 00123 * 00124 * @code 00125 * IMPORT_SYMBOL ( my_func, int my_func ( int arg ) ); 00126 * IMPORT_SYMBOL ( my_var, int my_var ); 00127 * 00128 * void use_imports ( void ) { 00129 * if ( my_func && &my_var ) 00130 * my_var = my_func ( my_var ); 00131 * } 00132 * @endcode 00133 * 00134 * GCC considers a weak declaration to override a strong one no matter 00135 * which comes first, so it is safe to include a header file declaring 00136 * the imported symbol normally, but providing the declaration to 00137 * IMPORT_SYMBOL is still required. 00138 * 00139 * If no EXPORT_SYMBOL declaration exists for the imported symbol in 00140 * another file, the behavior will be most likely be identical to that 00141 * for an unavailable symbol. 00142 */ 00143 #ifdef ASSEMBLY 00144 #define IMPORT_SYMBOL( _sym ) \ 00145 REQUEST_SYMBOL ( __export_ ## _sym ) ; \ 00146 .weak _sym 00147 #else /* ASSEMBLY */ 00148 #define IMPORT_SYMBOL( _sym, _decl ) \ 00149 REQUEST_SYMBOL ( __export_ ## _sym ) ; \ 00150 extern _decl __attribute__ (( weak )) 00151 #endif 00152 00153 /** @} */ 00154 00155 /** 00156 * @defgroup objmacros Macros to provide or require explicit objects 00157 * @{ 00158 */ 00159 00160 #define PREFIX_OBJECT( _prefix ) _C2 ( _prefix, OBJECT ) 00161 #define OBJECT_SYMBOL PREFIX_OBJECT ( obj_ ) 00162 #define REQUEST_EXPANDED( _sym ) REQUEST_SYMBOL ( _sym ) 00163 #define CONFIG_SYMBOL PREFIX_OBJECT ( obj_config_ ) 00164 00165 /** Always provide the symbol for the current object (defined by -DOBJECT) */ 00166 PROVIDE_SYMBOL ( OBJECT_SYMBOL ); 00167 00168 /** Pull in an object-specific configuration file if available */ 00169 REQUEST_EXPANDED ( CONFIG_SYMBOL ); 00170 00171 /** Explicitly require another object */ 00172 #define REQUIRE_OBJECT( _obj ) REQUIRE_SYMBOL ( obj_ ## _obj ) 00173 00174 /** Pull in another object if it exists */ 00175 #define REQUEST_OBJECT( _obj ) REQUEST_SYMBOL ( obj_ ## _obj ) 00176 00177 /** @} */ 00178 00179 /** Select file identifier for errno.h (if used) */ 00180 #define ERRFILE PREFIX_OBJECT ( ERRFILE_ ) 00181 00182 /** 00183 * @defgroup weakmacros Macros to manage weak symbol definitions 00184 * 00185 * Weak symbols allow one to reference a function in another file 00186 * without necessarily requiring that file to be linked in. In their 00187 * native form, the function will be @c NULL if its file is not linked 00188 * in; these macros provide an inline wrapper that returns an 00189 * appropriate error indication or default value. 00190 * 00191 * @{ 00192 */ 00193 #ifndef ASSEMBLY 00194 00195 /** Mangle @a name into its weakly-referenced implementation */ 00196 #define __weak_impl( name ) _w_ ## name 00197 00198 /** 00199 * Declare a weak function with inline safety wrapper 00200 * 00201 * @v ret Return type of weak function 00202 * @v name Name of function to expose 00203 * @v proto Parenthesized list of arguments with types 00204 * @v args Parenthesized list of argument names 00205 * @v dfl Value to return if weak function is not available 00206 */ 00207 #define __weak_decl( ret, name, proto, args, dfl ) \ 00208 ret __weak_impl( name ) proto __attribute__ (( weak )); \ 00209 static inline ret name proto { \ 00210 if ( __weak_impl( name ) ) \ 00211 return __weak_impl( name ) args; \ 00212 return dfl; \ 00213 } 00214 00215 #endif 00216 /** @} */ 00217 00218 /** @defgroup dbg Debugging infrastructure 00219 * @{ 00220 */ 00221 #ifndef ASSEMBLY 00222 00223 /** @def DBG 00224 * 00225 * Print a debugging message. 00226 * 00227 * The debug level is set at build time by specifying the @c DEBUG= 00228 * parameter on the @c make command line. For example, to enable 00229 * debugging for the PCI bus functions (in pci.c) in a @c .dsk image 00230 * for the @c rtl8139 card, you could use the command line 00231 * 00232 * @code 00233 * 00234 * make bin/rtl8139.dsk DEBUG=pci 00235 * 00236 * @endcode 00237 * 00238 * This will enable the debugging statements (DBG()) in pci.c. If 00239 * debugging is not enabled, DBG() statements will be ignored. 00240 * 00241 * You can enable debugging in several objects simultaneously by 00242 * separating them with commas, as in 00243 * 00244 * @code 00245 * 00246 * make bin/rtl8139.dsk DEBUG=pci,buffer,heap 00247 * 00248 * @endcode 00249 * 00250 * You can increase the debugging level for an object by specifying it 00251 * with @c :N, where @c N is the level, as in 00252 * 00253 * @code 00254 * 00255 * make bin/rtl8139.dsk DEBUG=pci,buffer:2,heap 00256 * 00257 * @endcode 00258 * 00259 * which would enable debugging for the PCI, buffer-handling and 00260 * heap-allocation code, with the buffer-handling code at level 2. 00261 * 00262 */ 00263 00264 /* 00265 * If debug_OBJECT is set to a true value, the macro DBG(...) will 00266 * expand to printf(...) when compiling OBJECT, and the symbol 00267 * DEBUG_LEVEL will be inserted into the object file. 00268 * 00269 */ 00270 #define DEBUG_SYMBOL PREFIX_OBJECT ( debug_ ) 00271 00272 /** printf() for debugging 00273 * 00274 * This function exists so that the DBG() macros can expand to 00275 * printf() calls without dragging the printf() prototype into scope. 00276 * 00277 * As far as the compiler is concerned, dbg_printf() and printf() are 00278 * completely unrelated calls; it's only at the assembly stage that 00279 * references to the dbg_printf symbol are collapsed into references 00280 * to the printf symbol. 00281 */ 00282 extern int __attribute__ (( format ( printf, 1, 2 ) )) 00283 dbg_printf ( const char *fmt, ... ) asm ( "printf" ); 00284 00285 extern void dbg_autocolourise ( unsigned long id ); 00286 extern void dbg_decolourise ( void ); 00287 extern void dbg_hex_dump_da ( unsigned long dispaddr, 00288 const void *data, unsigned long len ); 00289 00290 #if DEBUG_SYMBOL 00291 #define DBGLVL_MAX DEBUG_SYMBOL 00292 #else 00293 #define DBGLVL_MAX 0 00294 #endif 00295 00296 /* Allow for selective disabling of enabled debug levels */ 00297 #if DBGLVL_MAX 00298 int __debug_disable; 00299 #define DBGLVL ( DBGLVL_MAX & ~__debug_disable ) 00300 #define DBG_DISABLE( level ) do { \ 00301 __debug_disable |= ( (level) & DBGLVL_MAX ); \ 00302 } while ( 0 ) 00303 #define DBG_ENABLE( level ) do { \ 00304 __debug_disable &= ~( (level) & DBGLVL_MAX ); \ 00305 } while ( 0 ) 00306 #else 00307 #define DBGLVL 0 00308 #define DBG_DISABLE( level ) do { } while ( 0 ) 00309 #define DBG_ENABLE( level ) do { } while ( 0 ) 00310 #endif 00311 00312 #define DBGLVL_LOG 1 00313 #define DBG_LOG ( DBGLVL & DBGLVL_LOG ) 00314 #define DBGLVL_EXTRA 2 00315 #define DBG_EXTRA ( DBGLVL & DBGLVL_EXTRA ) 00316 #define DBGLVL_PROFILE 4 00317 #define DBG_PROFILE ( DBGLVL & DBGLVL_PROFILE ) 00318 #define DBGLVL_IO 8 00319 #define DBG_IO ( DBGLVL & DBGLVL_IO ) 00320 00321 /** 00322 * Print debugging message if we are at a certain debug level 00323 * 00324 * @v level Debug level 00325 * @v ... printf() argument list 00326 */ 00327 #define DBG_IF( level, ... ) do { \ 00328 if ( DBG_ ## level ) { \ 00329 dbg_printf ( __VA_ARGS__ ); \ 00330 } \ 00331 } while ( 0 ) 00332 00333 /** 00334 * Print a hex dump if we are at a certain debug level 00335 * 00336 * @v level Debug level 00337 * @v dispaddr Display address 00338 * @v data Data to print 00339 * @v len Length of data 00340 */ 00341 #define DBG_HDA_IF( level, dispaddr, data, len ) do { \ 00342 if ( DBG_ ## level ) { \ 00343 union { \ 00344 unsigned long ul; \ 00345 typeof ( dispaddr ) raw; \ 00346 } da; \ 00347 da.raw = dispaddr; \ 00348 dbg_hex_dump_da ( da.ul, data, len ); \ 00349 } \ 00350 } while ( 0 ) 00351 00352 /** 00353 * Print a hex dump if we are at a certain debug level 00354 * 00355 * @v level Debug level 00356 * @v data Data to print 00357 * @v len Length of data 00358 */ 00359 #define DBG_HD_IF( level, data, len ) do { \ 00360 const void *_data = data; \ 00361 DBG_HDA_IF ( level, _data, _data, len ); \ 00362 } while ( 0 ) 00363 00364 /** 00365 * Select colour for debug messages if we are at a certain debug level 00366 * 00367 * @v level Debug level 00368 * @v id Message stream ID 00369 */ 00370 #define DBG_AC_IF( level, id ) do { \ 00371 if ( DBG_ ## level ) { \ 00372 union { \ 00373 unsigned long ul; \ 00374 typeof ( id ) raw; \ 00375 } dbg_stream; \ 00376 dbg_stream.raw = id; \ 00377 dbg_autocolourise ( dbg_stream.ul ); \ 00378 } \ 00379 } while ( 0 ) 00380 00381 /** 00382 * Revert colour for debug messages if we are at a certain debug level 00383 * 00384 * @v level Debug level 00385 */ 00386 #define DBG_DC_IF( level ) do { \ 00387 if ( DBG_ ## level ) { \ 00388 dbg_decolourise(); \ 00389 } \ 00390 } while ( 0 ) 00391 00392 /* Autocolourising versions of the DBGxxx_IF() macros */ 00393 00394 #define DBGC_IF( level, id, ... ) do { \ 00395 DBG_AC_IF ( level, id ); \ 00396 DBG_IF ( level, __VA_ARGS__ ); \ 00397 DBG_DC_IF ( level ); \ 00398 } while ( 0 ) 00399 00400 #define DBGC_HDA_IF( level, id, ... ) do { \ 00401 DBG_AC_IF ( level, id ); \ 00402 DBG_HDA_IF ( level, __VA_ARGS__ ); \ 00403 DBG_DC_IF ( level ); \ 00404 } while ( 0 ) 00405 00406 #define DBGC_HD_IF( level, id, ... ) do { \ 00407 DBG_AC_IF ( level, id ); \ 00408 DBG_HD_IF ( level, __VA_ARGS__ ); \ 00409 DBG_DC_IF ( level ); \ 00410 } while ( 0 ) 00411 00412 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( LOG, ... )*/ 00413 00414 #define DBG( ... ) DBG_IF ( LOG, __VA_ARGS__ ) 00415 #define DBG_HDA( ... ) DBG_HDA_IF ( LOG, __VA_ARGS__ ) 00416 #define DBG_HD( ... ) DBG_HD_IF ( LOG, __VA_ARGS__ ) 00417 #define DBGC( ... ) DBGC_IF ( LOG, __VA_ARGS__ ) 00418 #define DBGC_HDA( ... ) DBGC_HDA_IF ( LOG, __VA_ARGS__ ) 00419 #define DBGC_HD( ... ) DBGC_HD_IF ( LOG, __VA_ARGS__ ) 00420 00421 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( EXTRA, ... )*/ 00422 00423 #define DBG2( ... ) DBG_IF ( EXTRA, __VA_ARGS__ ) 00424 #define DBG2_HDA( ... ) DBG_HDA_IF ( EXTRA, __VA_ARGS__ ) 00425 #define DBG2_HD( ... ) DBG_HD_IF ( EXTRA, __VA_ARGS__ ) 00426 #define DBGC2( ... ) DBGC_IF ( EXTRA, __VA_ARGS__ ) 00427 #define DBGC2_HDA( ... ) DBGC_HDA_IF ( EXTRA, __VA_ARGS__ ) 00428 #define DBGC2_HD( ... ) DBGC_HD_IF ( EXTRA, __VA_ARGS__ ) 00429 00430 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( PROFILE, ... )*/ 00431 00432 #define DBGP( ... ) DBG_IF ( PROFILE, __VA_ARGS__ ) 00433 #define DBGP_HDA( ... ) DBG_HDA_IF ( PROFILE, __VA_ARGS__ ) 00434 #define DBGP_HD( ... ) DBG_HD_IF ( PROFILE, __VA_ARGS__ ) 00435 #define DBGCP( ... ) DBGC_IF ( PROFILE, __VA_ARGS__ ) 00436 #define DBGCP_HDA( ... ) DBGC_HDA_IF ( PROFILE, __VA_ARGS__ ) 00437 #define DBGCP_HD( ... ) DBGC_HD_IF ( PROFILE, __VA_ARGS__ ) 00438 00439 /* Versions of the DBGxxx_IF() macros that imply DBGxxx_IF( IO, ... )*/ 00440 00441 #define DBGIO( ... ) DBG_IF ( IO, __VA_ARGS__ ) 00442 #define DBGIO_HDA( ... ) DBG_HDA_IF ( IO, __VA_ARGS__ ) 00443 #define DBGIO_HD( ... ) DBG_HD_IF ( IO, __VA_ARGS__ ) 00444 #define DBGCIO( ... ) DBGC_IF ( IO, __VA_ARGS__ ) 00445 #define DBGCIO_HDA( ... ) DBGC_HDA_IF ( IO, __VA_ARGS__ ) 00446 #define DBGCIO_HD( ... ) DBGC_HD_IF ( IO, __VA_ARGS__ ) 00447 00448 00449 #if DEBUG_SYMBOL == 0 00450 #define NDEBUG 00451 #endif 00452 00453 #endif /* ASSEMBLY */ 00454 /** @} */ 00455 00456 /** @defgroup attrs Miscellaneous attributes 00457 * @{ 00458 */ 00459 #ifndef ASSEMBLY 00460 00461 /** Declare a data structure as packed. */ 00462 #define PACKED __attribute__ (( packed )) 00463 00464 /** Declare a variable or data structure as unused. */ 00465 #define __unused __attribute__ (( unused )) 00466 00467 /** 00468 * Declare a function as pure - i.e. without side effects 00469 */ 00470 #define __pure __attribute__ (( pure )) 00471 00472 /** 00473 * Declare a function as const - i.e. it does not access global memory 00474 * (including dereferencing pointers passed to it) at all. 00475 * Must also not call any non-const functions. 00476 */ 00477 #define __const __attribute__ (( const )) 00478 00479 /** 00480 * Declare a function's pointer parameters as non-null - i.e. force 00481 * compiler to check pointers at compile time and enable possible 00482 * optimizations based on that fact 00483 */ 00484 #define __nonnull __attribute__ (( nonnull )) 00485 00486 /** 00487 * Declare a pointer returned by a function as a unique memory address 00488 * as returned by malloc-type functions. 00489 */ 00490 #define __malloc __attribute__ (( malloc )) 00491 00492 /** 00493 * Declare a function as used. 00494 * 00495 * Necessary only if the function is called only from assembler code. 00496 */ 00497 #define __used __attribute__ (( used )) 00498 00499 /** Declare a data structure to be aligned with 16-byte alignment */ 00500 #define __aligned __attribute__ (( aligned ( 16 ) )) 00501 00502 /** Declare a function to be always inline */ 00503 #define __always_inline __attribute__ (( always_inline )) 00504 00505 /** 00506 * Shared data. 00507 * 00508 * To save space in the binary when multiple-driver images are 00509 * compiled, uninitialised data areas can be shared between drivers. 00510 * This will typically be used to share statically-allocated receive 00511 * and transmit buffers between drivers. 00512 * 00513 * Use as e.g. 00514 * 00515 * @code 00516 * 00517 * struct { 00518 * char rx_buf[NUM_RX_BUF][RX_BUF_SIZE]; 00519 * char tx_buf[TX_BUF_SIZE]; 00520 * } my_static_data __shared; 00521 * 00522 * @endcode 00523 * 00524 */ 00525 #define __shared __asm__ ( "_shared_bss" ) __aligned 00526 00527 #endif /* ASSEMBLY */ 00528 /** @} */ 00529 00530 /** 00531 * Optimisation barrier 00532 */ 00533 #ifndef ASSEMBLY 00534 #define barrier() __asm__ __volatile__ ( "" : : : "memory" ) 00535 #endif /* ASSEMBLY */ 00536 00537 /** 00538 * @defgroup licences Licence declarations 00539 * 00540 * For reasons that are partly historical, various different files 00541 * within the gPXE codebase have differing licences. 00542 * 00543 * @{ 00544 */ 00545 00546 /** Declare a file as being in the public domain 00547 * 00548 * This licence declaration is applicable when a file states itself to 00549 * be in the public domain. 00550 */ 00551 #define FILE_LICENCE_PUBLIC_DOMAIN \ 00552 PROVIDE_SYMBOL ( __licence_public_domain ) 00553 00554 /** Declare a file as being under version 2 (or later) of the GNU GPL 00555 * 00556 * This licence declaration is applicable when a file states itself to 00557 * be licensed under the GNU GPL; "either version 2 of the License, or 00558 * (at your option) any later version". 00559 */ 00560 #define FILE_LICENCE_GPL2_OR_LATER \ 00561 PROVIDE_SYMBOL ( __licence_gpl2_or_later ) 00562 00563 /** Declare a file as being under version 2 of the GNU GPL 00564 * 00565 * This licence declaration is applicable when a file states itself to 00566 * be licensed under version 2 of the GPL, and does not include the 00567 * "or, at your option, any later version" clause. 00568 */ 00569 #define FILE_LICENCE_GPL2_ONLY \ 00570 PROVIDE_SYMBOL ( __licence_gpl2_only ) 00571 00572 /** Declare a file as being under any version of the GNU GPL 00573 * 00574 * This licence declaration is applicable when a file states itself to 00575 * be licensed under the GPL, but does not specify a version. 00576 * 00577 * According to section 9 of the GPLv2, "If the Program does not 00578 * specify a version number of this License, you may choose any 00579 * version ever published by the Free Software Foundation". 00580 */ 00581 #define FILE_LICENCE_GPL_ANY \ 00582 PROVIDE_SYMBOL ( __licence_gpl_any ) 00583 00584 /** Declare a file as being under the three-clause BSD licence 00585 * 00586 * This licence declaration is applicable when a file states itself to 00587 * be licensed under terms allowing redistribution in source and 00588 * binary forms (with or without modification) provided that: 00589 * 00590 * redistributions of source code retain the copyright notice, 00591 * list of conditions and any attached disclaimers 00592 * 00593 * redistributions in binary form reproduce the copyright notice, 00594 * list of conditions and any attached disclaimers in the 00595 * documentation and/or other materials provided with the 00596 * distribution 00597 * 00598 * the name of the author is not used to endorse or promote 00599 * products derived from the software without specific prior 00600 * written permission 00601 * 00602 * It is not necessary for the file to explicitly state that it is 00603 * under a "BSD" licence; only that the licensing terms be 00604 * functionally equivalent to the standard three-clause BSD licence. 00605 */ 00606 #define FILE_LICENCE_BSD3 \ 00607 PROVIDE_SYMBOL ( __licence_bsd3 ) 00608 00609 /** Declare a file as being under the two-clause BSD licence 00610 * 00611 * This licence declaration is applicable when a file states itself to 00612 * be licensed under terms allowing redistribution in source and 00613 * binary forms (with or without modification) provided that: 00614 * 00615 * redistributions of source code retain the copyright notice, 00616 * list of conditions and any attached disclaimers 00617 * 00618 * redistributions in binary form reproduce the copyright notice, 00619 * list of conditions and any attached disclaimers in the 00620 * documentation and/or other materials provided with the 00621 * distribution 00622 * 00623 * It is not necessary for the file to explicitly state that it is 00624 * under a "BSD" licence; only that the licensing terms be 00625 * functionally equivalent to the standard two-clause BSD licence. 00626 */ 00627 #define FILE_LICENCE_BSD2 \ 00628 PROVIDE_SYMBOL ( __licence_bsd2 ) 00629 00630 /** Declare a file as being under the one-clause MIT-style licence 00631 * 00632 * This licence declaration is applicable when a file states itself to 00633 * be licensed under terms allowing redistribution for any purpose 00634 * with or without fee, provided that the copyright notice and 00635 * permission notice appear in all copies. 00636 */ 00637 #define FILE_LICENCE_MIT \ 00638 PROVIDE_SYMBOL ( __licence_mit ) 00639 00640 /** Declare a particular licence as applying to a file */ 00641 #define FILE_LICENCE( _licence ) FILE_LICENCE_ ## _licence 00642 00643 /** @} */ 00644 00645 /* This file itself is under GPLv2-or-later */ 00646 FILE_LICENCE ( GPL2_OR_LATER ); 00647 00648 #include <bits/compiler.h> 00649 00650 #endif /* COMPILER_H */
1.5.7.1