FreeCalypso > hg > fc-magnetite
comparison src/gpf3/inc/pub_L1_misc_enter.h @ 2:c41a534f33c6
src/gpf3: preened GPF goo from TCS3.2
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 25 Sep 2016 23:52:50 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:864b8cc0cf63 | 2:c41a534f33c6 |
|---|---|
| 1 /* | |
| 2 +------------------------------------------------------------------------------ | |
| 3 | File: pub_L1_misc_enter.h | |
| 4 +------------------------------------------------------------------------------ | |
| 5 | Copyright 2004 Texas Instruments Deutschland GmbH | |
| 6 | All rights reserved. | |
| 7 | | |
| 8 | This file is confidential and a trade secret of Texas | |
| 9 | Instruments Deutschland GmbH. | |
| 10 | The receipt of or possession of this file does not convey | |
| 11 | any rights to reproduce or disclose its contents or to | |
| 12 | manufacture, use, or sell anything it may describe, in | |
| 13 | whole, or in part, without the specific written consent of | |
| 14 | Texas Instruments Deutschland GmbH. | |
| 15 +------------------------------------------------------------------------------ | |
| 16 | Purpose: Check the SrcFileTime of the ccdgen generated header files at link time. | |
| 17 | | |
| 18 | The macros in this file help to detect version mismatch between | |
| 19 | header files included for build of different libraries. | |
| 20 | Example of a linker error: | |
| 21 | xx_tdc_3_constraints.obj : error LNK2001: | |
| 22 | unresolved external symbol | |
| 23 | "char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002" | |
| 24 | (?BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002@@3DA) | |
| 25 | \gpf\util\teststack\bin\test_xx_tdc\xx_tdc.dll : | |
| 26 | fatal error LNK1120: 1 unresolved externals | |
| 27 | Error executing link.exe. | |
| 28 | | |
| 29 | The first group of macros (protected by PUB_L1_MISC_ENTER) are necessary | |
| 30 | to build the strings of type "BadLibVersionCheck__xxx". | |
| 31 | | |
| 32 | They need in turn other macros which are set in the *.h files of | |
| 33 | cdginc, tdcinc or message_san.h directory. | |
| 34 | (e.g. PUB_L1_MISC_ENTER__M_XX_VAL_H__FILE_TYPE) | |
| 35 | | |
| 36 | The check is done only for the header files where | |
| 37 | ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK is switched on. | |
| 38 | | |
| 39 +------------------------------------------------------------------------------ | |
| 40 */ | |
| 41 | |
| 42 #ifndef PUB_L1_MISC_ENTER | |
| 43 #define PUB_L1_MISC_ENTER | |
| 44 | |
| 45 | |
| 46 /* we need a 2 stage approach to expand A and B before concatting them */ | |
| 47 #define PUB_L1_MISC_ENTER_CONCATx(A,B) A##B | |
| 48 #define PUB_L1_MISC_ENTER_CONCAT(A,B) PUB_L1_MISC_ENTER_CONCATx(A,B) | |
| 49 #define PUB_L1_MISC_ENTER_CONCAT3x(A,B,C) A##B##C | |
| 50 #define PUB_L1_MISC_ENTER_CONCAT3(A,B,C) PUB_L1_MISC_ENTER_CONCAT3x(A,B,C) | |
| 51 #define PUB_L1_MISC_ENTER_CONCAT4x(A,B,C,D) A##B##C##D | |
| 52 #define PUB_L1_MISC_ENTER_CONCAT4(A,B,C,D) PUB_L1_MISC_ENTER_CONCAT4x(A,B,C,D) | |
| 53 | |
| 54 /* we need a 2 stage approach to expand A before stringifying it */ | |
| 55 #define PUB_L1_MISC_ENTER_STRINGx(A) #A | |
| 56 #define PUB_L1_MISC_ENTER_STRING(A) PUB_L1_MISC_ENTER_STRINGx(A) | |
| 57 | |
| 58 #define PUB_L1_MISC_ENTER_GET_PRAGMA(PRAGMA) PUB_L1_MISC_ENTER_CONCAT3(PUB_L1_MISC_ENTER_,PUB_L1_MISC_ENTER__FILENAME,__##PRAGMA) | |
| 59 | |
| 60 | |
| 61 #define PUB_L1_MISC_ENTER_GET_FILE_TYPE PUB_L1_MISC_ENTER_CONCAT(PUB_L1_MISC_ENTER_FILE_TYPE__,PUB_L1_MISC_ENTER_GET_PRAGMA(FILE_TYPE)) | |
| 62 | |
| 63 #define PUB_L1_MISC_ENTER_SANITY_NAME PUB_L1_MISC_ENTER_CONCAT4(BadLibVersionCheck___,PUB_L1_MISC_ENTER__FILENAME,___,PUB_L1_MISC_ENTER_GET_PRAGMA(SRC_FILE_TIME)) | |
| 64 | |
| 65 | |
| 66 /* create an enumerate sequence of the known file types so we can test which one we have with a '#if A == B' line */ | |
| 67 #define PUB_L1_MISC_ENTER_FILE_TYPE__CDGINC 1 | |
| 68 #define PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC 2 | |
| 69 #define PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC_DSC 3 | |
| 70 #define PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC_MAIN 4 | |
| 71 #endif | |
| 72 | |
| 73 /* | |
| 74 * The check will be done only for files where | |
| 75 * ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK is switched on. | |
| 76 */ | |
| 77 #if (PUB_L1_MISC_ENTER_GET_FILE_TYPE == PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC) | |
| 78 #define ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK | |
| 79 #endif | |
| 80 | |
| 81 #ifdef PUB_L1_MISC_ENTER_DEBUG | |
| 82 #pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER__FILENAME)) | |
| 83 #pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER_SANITY_NAME)) | |
| 84 #pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER_GET_FILE_TYPE)) | |
| 85 #endif | |
| 86 | |
| 87 #ifdef ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK | |
| 88 #ifdef PUB_L1_MISC_ENTER_DEFINE_SANITY | |
| 89 | |
| 90 char PUB_L1_MISC_ENTER_SANITY_NAME; | |
| 91 #else | |
| 92 #ifdef PUB_L1_MISC_ENTER_DEBUG | |
| 93 #pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER_CONCAT(BadLibVersionCheck___,PUB_L1_MISC_ENTER__FILENAME))) | |
| 94 #endif | |
| 95 /* This part goes into | |
| 96 every stack file using the ccdgen generated files (one for each used file) | |
| 97 | |
| 98 expands to e.g. | |
| 99 extern char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002 | |
| 100 */ | |
| 101 extern char PUB_L1_MISC_ENTER_SANITY_NAME; | |
| 102 /* Originally it was this but since no one actually uses this stuff (we only have | |
| 103 it for the linker to check that versions match) we can save memory by only | |
| 104 storing the 8 lower bits. | |
| 105 | |
| 106 expands to e.g. | |
| 107 static char BadLibVersionCheck____P_XX_TDC_3_VAL_H = (char)(&BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002); | |
| 108 */ | |
| 109 static char PUB_L1_MISC_ENTER_CONCAT(BadLibVersionCheck___,PUB_L1_MISC_ENTER__FILENAME) = (char)(&PUB_L1_MISC_ENTER_SANITY_NAME); | |
| 110 #endif | |
| 111 #endif |
