Changeset 3140 for trunk/src/kmk/kbuild-object.c
- Timestamp:
- Mar 14, 2018, 10:28:10 PM (7 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
-
Property svn:mergeinfo
set to
/vendor/gnumake/current merged eligible
-
Property svn:mergeinfo
set to
-
trunk/src/kmk/kbuild-object.c
r3065 r3140 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "make .h"31 #include "makeint.h" 32 32 #include "filedef.h" 33 33 #include "variable.h" … … 81 81 char *pszName; 82 82 /** The file location where this define was declared. */ 83 struct flocFileLoc;83 floc FileLoc; 84 84 85 85 /** Pointer to the next element in the global list. */ … … 153 153 static struct kbuild_object * 154 154 parse_kbuild_object_variable_accessor(const char *pchExpr, size_t cchExpr, 155 enum kBuildSeverity enmSeverity, const structfloc *pFileLoc,155 enum kBuildSeverity enmSeverity, const floc *pFileLoc, 156 156 const char **ppchVarNm, size_t *pcchVarNm, enum kBuildType *penmType); 157 157 … … 176 176 * @param ... Arguments for the format string. 177 177 */ 178 static void kbuild_report_problem(enum kBuildSeverity enmSeverity, const structfloc *pFileLoc,178 static void kbuild_report_problem(enum kBuildSeverity enmSeverity, const floc *pFileLoc, 179 179 const char *pszFormat, ...) 180 180 { … … 193 193 { 194 194 case kBuildSeverity_Warning: 195 message(0, "%s", szBuf);195 OS(message, 0, "%s", szBuf); 196 196 break; 197 197 case kBuildSeverity_Error: 198 error(pFileLoc, "%s", szBuf);198 OS(error, pFileLoc, "%s", szBuf); 199 199 break; 200 200 default: 201 201 case kBuildSeverity_Fatal: 202 fatal(pFileLoc, "%s", szBuf);202 OS(fatal, pFileLoc, "%s", szBuf); 203 203 break; 204 204 } … … 340 340 static const char * 341 341 kbuild_replace_special_accessors(const char *pchValue, size_t *pcchValue, int *pfDuplicateValue, 342 const structfloc *pFileLoc)342 const floc *pFileLoc) 343 343 { 344 344 size_t cchValue = *pcchValue; … … 464 464 } 465 465 else 466 error(pFileLoc, _("The '$([%.*s...' accessor can only be used in the context of a kBuild object"),466 error(pFileLoc, 20, _("The '$([%.*s...' accessor can only be used in the context of a kBuild object"), 467 467 MAX(cchLeft, 20), pchLeft); 468 468 } … … 475 475 const char *pchValue, size_t cchValue, 476 476 int fDuplicateValue, enum variable_origin enmOrigin, 477 int fRecursive, int fNoSpecialAccessors, const structfloc *pFileLoc)477 int fRecursive, int fNoSpecialAccessors, const floc *pFileLoc) 478 478 { 479 479 struct variable *pVar; … … 504 504 &global_variable_set, pFileLoc); 505 505 if (!pAlias->alias) 506 error(pFileLoc, _("Error defining alias '%s'"), pszPrefixed);506 OS(error, pFileLoc, _("Error defining alias '%s'"), pszPrefixed); 507 507 } 508 508 … … 515 515 const char *pchValue, size_t cchValue, 516 516 int fDuplicateValue, enum variable_origin enmOrigin, 517 int fRecursive, const structfloc *pFileLoc)517 int fRecursive, const floc *pFileLoc) 518 518 { 519 519 return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchName, cchName), … … 549 549 const char *pszValue, size_t cchValue, int fDuplicateValue, 550 550 enum variable_origin enmOrigin, int fRecursive, 551 structfloc const *pFileLoc)551 floc const *pFileLoc) 552 552 { 553 553 struct kbuild_object *pObj; … … 561 561 assert(pObj != NULL); 562 562 if (!is_valid_kbuild_object_variable_name(pchVarNm, cchVarNm)) 563 fatal(pFileLoc, _("Invalid kBuild object variable name: '%.*s' ('%.*s')"),563 fatal(pFileLoc, cchVarNm + cchName, _("Invalid kBuild object variable name: '%.*s' ('%.*s')"), 564 564 (int)cchVarNm, pchVarNm, (int)cchName, pchName); 565 565 return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchVarNm, cchVarNm), … … 596 596 const char *pszValue, size_t cchValue, int fDuplicateValue, 597 597 enum variable_origin enmOrigin, int fRecursive, 598 structfloc const *pFileLoc)598 floc const *pFileLoc) 599 599 { 600 600 assert(g_pTopKbEvalData != NULL); 601 601 602 602 if (!is_valid_kbuild_object_variable_name(pchName, cchName)) 603 fatal(pFileLoc, _("Invalid kBuild object variable name: '%.*s'"), (int)cchName, pchName);603 fatal(pFileLoc, cchName, _("Invalid kBuild object variable name: '%.*s'"), (int)cchName, pchName); 604 604 605 605 return define_kbuild_object_variable_cached(g_pTopKbEvalData->pObj, strcache2_add(&variable_strcache, pchName, cchName), … … 631 631 const char *pchValue, size_t cchValue, int fSimpleValue, 632 632 enum variable_origin enmOrigin, int fAppend, 633 const structfloc *pFileLoc)633 const floc *pFileLoc) 634 634 { 635 635 struct kbuild_object *pObj; … … 660 660 */ 661 661 if (!is_valid_kbuild_object_variable_name(pchName, cchName)) 662 fatal(pFileLoc, _("Invalid kBuild object variable name: '%.*s'"), (int)cchName, pchName);662 fatal(pFileLoc, cchName, _("Invalid kBuild object variable name: '%.*s'"), (int)cchName, pchName); 663 663 664 664 /* … … 844 844 && ( pCur->pParent == pObj 845 845 || !strcmp(pCur->pszParent, pObj->pszName)) ) 846 fatal(&pObj->FileLoc, _("'%s' and '%s' are both trying to be each other children..."),847 846 OSS(fatal, &pObj->FileLoc, _("'%s' and '%s' are both trying to be each other children..."), 847 pObj->pszName, pCur->pszName); 848 848 849 849 pObj->pParent = pCur; … … 857 857 /* Not found. */ 858 858 if (!fQuiet) 859 error(&pObj->FileLoc, _("Could not locate parent '%s' of '%s'"), pObj->pszParent, pObj->pszName);859 OSS(error, &pObj->FileLoc, _("Could not locate parent '%s' of '%s'"), pObj->pszParent, pObj->pszName); 860 860 } 861 861 return pObj->pParent; … … 892 892 893 893 static int 894 eval_kbuild_define_xxxx(struct kbuild_eval_data **ppData, const structfloc *pFileLoc,894 eval_kbuild_define_xxxx(struct kbuild_eval_data **ppData, const floc *pFileLoc, 895 895 const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildType enmType) 896 896 { … … 933 933 pObj->pszName = allocate_expanded_next_token(&pszLine, pszEos, &pObj->cchName, 1 /*strip*/); 934 934 if (!pObj->pszName || !*pObj->pszName) 935 fatal(pFileLoc, _("The kBuild define requires a name"));935 O(fatal, pFileLoc, _("The kBuild define requires a name")); 936 936 937 937 psz = pObj->pszName; … … 939 939 if (!isgraph(ch)) 940 940 { 941 error(pFileLoc, _("The 'kBuild-define-%s' name '%s' contains one or more invalid characters"),942 941 OSS(error, pFileLoc, _("The 'kBuild-define-%s' name '%s' contains one or more invalid characters"), 942 eval_kbuild_type_to_string(enmType), pObj->pszName); 943 943 break; 944 944 } … … 955 955 case kBuildType_Unit: pszPrefix = "UNIT_"; break; 956 956 default: 957 fatal(pFileLoc, _("enmType=%d"), enmType);957 ON(fatal, pFileLoc, _("enmType=%d"), enmType); 958 958 return -1; 959 959 } … … 974 974 /* Inheritance directive. */ 975 975 if (pObj->pszParent != NULL) 976 fatal(pFileLoc, _("'extending' can only occure once"));976 O(fatal, pFileLoc, _("'extending' can only occure once")); 977 977 pObj->pszParent = allocate_expanded_next_token(&pszLine, pszEos, &pObj->cchParent, 1 /*strip*/); 978 978 if (!pObj->pszParent || !*pObj->pszParent) 979 fatal(pFileLoc, _("'extending' requires a parent name"));979 O(fatal, pFileLoc, _("'extending' requires a parent name")); 980 980 } 981 981 else if (WORD_IS(psz, cch, "using")) … … 986 986 /* Template directive. */ 987 987 if (enmType != kBuildType_Target) 988 fatal(pFileLoc, _("'using <template>' can only be used with 'kBuild-define-target'"));988 O(fatal, pFileLoc, _("'using <template>' can only be used with 'kBuild-define-target'")); 989 989 if (pObj->pszTemplate != NULL) 990 fatal(pFileLoc, _("'using' can only occure once"));990 O(fatal, pFileLoc, _("'using' can only occure once")); 991 991 992 992 pszTemplate = allocate_expanded_next_token(&pszLine, pszEos, &cchTemplate, 1 /*fStrip*/); 993 993 if (!pszTemplate || !*pszTemplate) 994 fatal(pFileLoc, _("'using' requires a template name"));994 O(fatal, pFileLoc, _("'using' requires a template name")); 995 995 996 996 define_kbuild_object_variable_cached(pObj, g_pszVarNmTemplate, pszTemplate, cchTemplate, … … 1000 1000 } 1001 1001 else 1002 fatal(pFileLoc, _("Don't know what '%.*s' means"), (int)cch, psz);1002 fatal(pFileLoc, cch, _("Don't know what '%.*s' means"), (int)cch, psz); 1003 1003 1004 1004 /* next token */ … … 1027 1027 1028 1028 static int 1029 eval_kbuild_endef_xxxx(struct kbuild_eval_data **ppData, const structfloc *pFileLoc,1029 eval_kbuild_endef_xxxx(struct kbuild_eval_data **ppData, const floc *pFileLoc, 1030 1030 const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildType enmType) 1031 1031 { … … 1044 1044 if (!pData) 1045 1045 { 1046 error(pFileLoc, _("kBuild-endef-%s is missing kBuild-define-%s"),1047 1046 OSS(error, pFileLoc, _("kBuild-endef-%s is missing kBuild-define-%s"), 1047 eval_kbuild_type_to_string(enmType), eval_kbuild_type_to_string(enmType)); 1048 1048 return 0; 1049 1049 } … … 1054 1054 pObj = pData->pObj; 1055 1055 if (pObj->enmType != enmType) 1056 error(pFileLoc, _("'kBuild-endef-%s' does not match 'kBuild-define-%s %s'"),1057 1056 OSSS(error, pFileLoc, _("'kBuild-endef-%s' does not match 'kBuild-define-%s %s'"), 1057 eval_kbuild_type_to_string(enmType), eval_kbuild_type_to_string(pObj->enmType), pObj->pszName); 1058 1058 1059 1059 /* … … 1066 1066 if ( cchName != pObj->cchName 1067 1067 || strcmp(pszName, pObj->pszName)) 1068 error(pFileLoc, _("'kBuild-endef-%s %s' does not match 'kBuild-define-%s %s'"),1068 OSSSS(error, pFileLoc, _("'kBuild-endef-%s %s' does not match 'kBuild-define-%s %s'"), 1069 1069 eval_kbuild_type_to_string(enmType), pszName, 1070 1070 eval_kbuild_type_to_string(pObj->enmType), pObj->pszName); … … 1085 1085 } 1086 1086 1087 int eval_kbuild_read_hook(struct kbuild_eval_data **kdata, const structfloc *flocp,1087 int eval_kbuild_read_hook(struct kbuild_eval_data **kdata, const floc *flocp, 1088 1088 const char *pchWord, size_t cchWord, const char *line, const char *eos, int ignoring) 1089 1089 { … … 1124 1124 * extensions, at least until legacy assignments/whatever turns up. 1125 1125 */ 1126 error(flocp, _("Unknown syntax 'kBuild-%.*s'"), (int)cchWord, pchWord);1126 error(flocp, cchWord, _("Unknown syntax 'kBuild-%.*s'"), (int)cchWord, pchWord); 1127 1127 return 0; 1128 1128 } … … 1189 1189 static struct kbuild_object * 1190 1190 parse_kbuild_object_variable_accessor(const char *pchExpr, size_t cchExpr, 1191 enum kBuildSeverity enmSeverity, const structfloc *pFileLoc,1191 enum kBuildSeverity enmSeverity, const floc *pFileLoc, 1192 1192 const char **ppchVarNm, size_t *pcchVarNm, enum kBuildType *penmType) 1193 1193 { … … 1395 1395 putchar('\n'); 1396 1396 1397 print_variable_set(pCur->pVariables->set, "" );1397 print_variable_set(pCur->pVariables->set, "", 0); 1398 1398 1399 1399 printf("kBuild-endef-%s %s\n",
Note:
See TracChangeset
for help on using the changeset viewer.