Ignore:
Timestamp:
Mar 14, 2018, 10:28:10 PM (7 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

  • trunk/src/kmk/kbuild-object.c

    r3065 r3140  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "make.h"
     31#include "makeint.h"
    3232#include "filedef.h"
    3333#include "variable.h"
     
    8181    char                       *pszName;
    8282    /** The file location where this define was declared. */
    83     struct floc                 FileLoc;
     83    floc                        FileLoc;
    8484
    8585    /** Pointer to the next element in the global list. */
     
    153153static struct kbuild_object *
    154154parse_kbuild_object_variable_accessor(const char *pchExpr, size_t cchExpr,
    155                                       enum kBuildSeverity enmSeverity, const struct floc *pFileLoc,
     155                                      enum kBuildSeverity enmSeverity, const floc *pFileLoc,
    156156                                      const char **ppchVarNm, size_t *pcchVarNm, enum kBuildType *penmType);
    157157
     
    176176 * @param   ...                 Arguments for the format string.
    177177 */
    178 static void kbuild_report_problem(enum kBuildSeverity enmSeverity, const struct floc *pFileLoc,
     178static void kbuild_report_problem(enum kBuildSeverity enmSeverity, const floc *pFileLoc,
    179179                                  const char *pszFormat, ...)
    180180{
     
    193193    {
    194194        case kBuildSeverity_Warning:
    195             message(0, "%s", szBuf);
     195            OS(message, 0, "%s", szBuf);
    196196            break;
    197197        case kBuildSeverity_Error:
    198             error(pFileLoc, "%s", szBuf);
     198            OS(error, pFileLoc, "%s", szBuf);
    199199            break;
    200200        default:
    201201        case kBuildSeverity_Fatal:
    202             fatal(pFileLoc, "%s", szBuf);
     202            OS(fatal, pFileLoc, "%s", szBuf);
    203203            break;
    204204    }
     
    340340static const char *
    341341kbuild_replace_special_accessors(const char *pchValue, size_t *pcchValue, int *pfDuplicateValue,
    342                                  const struct floc *pFileLoc)
     342                                 const floc *pFileLoc)
    343343{
    344344    size_t      cchValue    = *pcchValue;
     
    464464        }
    465465        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"),
    467467                  MAX(cchLeft, 20), pchLeft);
    468468    }
     
    475475                                     const char *pchValue, size_t cchValue,
    476476                                     int fDuplicateValue, enum variable_origin enmOrigin,
    477                                      int fRecursive, int fNoSpecialAccessors, const struct floc *pFileLoc)
     477                                     int fRecursive, int fNoSpecialAccessors, const floc *pFileLoc)
    478478{
    479479    struct variable *pVar;
     
    504504                                              &global_variable_set, pFileLoc);
    505505        if (!pAlias->alias)
    506             error(pFileLoc, _("Error defining alias '%s'"), pszPrefixed);
     506            OS(error, pFileLoc, _("Error defining alias '%s'"), pszPrefixed);
    507507    }
    508508
     
    515515                              const char *pchValue, size_t cchValue,
    516516                              int fDuplicateValue, enum variable_origin enmOrigin,
    517                               int fRecursive, const struct floc *pFileLoc)
     517                              int fRecursive, const floc *pFileLoc)
    518518{
    519519    return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchName, cchName),
     
    549549                                               const char *pszValue, size_t cchValue, int fDuplicateValue,
    550550                                               enum variable_origin enmOrigin, int fRecursive,
    551                                                struct floc const *pFileLoc)
     551                                               floc const *pFileLoc)
    552552{
    553553    struct kbuild_object   *pObj;
     
    561561        assert(pObj != NULL);
    562562        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')"),
    564564                  (int)cchVarNm, pchVarNm, (int)cchName, pchName);
    565565        return define_kbuild_object_variable_cached(pObj, strcache2_add(&variable_strcache, pchVarNm, cchVarNm),
     
    596596                                         const char *pszValue, size_t cchValue, int fDuplicateValue,
    597597                                         enum variable_origin enmOrigin, int fRecursive,
    598                                          struct floc const *pFileLoc)
     598                                         floc const *pFileLoc)
    599599{
    600600    assert(g_pTopKbEvalData != NULL);
    601601
    602602    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);
    604604
    605605    return define_kbuild_object_variable_cached(g_pTopKbEvalData->pObj, strcache2_add(&variable_strcache, pchName, cchName),
     
    631631                                  const char *pchValue, size_t cchValue, int fSimpleValue,
    632632                                  enum variable_origin enmOrigin, int fAppend,
    633                                   const struct floc *pFileLoc)
     633                                  const floc *pFileLoc)
    634634{
    635635    struct kbuild_object   *pObj;
     
    660660     */
    661661    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);
    663663
    664664    /*
     
    844844                    &&  (   pCur->pParent == pObj
    845845                         || !strcmp(pCur->pszParent, pObj->pszName)) )
    846                     fatal(&pObj->FileLoc, _("'%s' and '%s' are both trying to be each other children..."),
    847                           pObj->pszName, pCur->pszName);
     846                    OSS(fatal, &pObj->FileLoc, _("'%s' and '%s' are both trying to be each other children..."),
     847                        pObj->pszName, pCur->pszName);
    848848
    849849                pObj->pParent = pCur;
     
    857857        /* Not found. */
    858858        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);
    860860    }
    861861    return pObj->pParent;
     
    892892
    893893static int
    894 eval_kbuild_define_xxxx(struct kbuild_eval_data **ppData, const struct floc *pFileLoc,
     894eval_kbuild_define_xxxx(struct kbuild_eval_data **ppData, const floc *pFileLoc,
    895895                        const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildType enmType)
    896896{
     
    933933    pObj->pszName = allocate_expanded_next_token(&pszLine, pszEos, &pObj->cchName, 1 /*strip*/);
    934934    if (!pObj->pszName || !*pObj->pszName)
    935         fatal(pFileLoc, _("The kBuild define requires a name"));
     935        O(fatal, pFileLoc, _("The kBuild define requires a name"));
    936936
    937937    psz = pObj->pszName;
     
    939939        if (!isgraph(ch))
    940940        {
    941             error(pFileLoc, _("The 'kBuild-define-%s' name '%s' contains one or more invalid characters"),
    942                   eval_kbuild_type_to_string(enmType), pObj->pszName);
     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);
    943943            break;
    944944        }
     
    955955        case kBuildType_Unit:        pszPrefix = "UNIT_"; break;
    956956        default:
    957             fatal(pFileLoc, _("enmType=%d"), enmType);
     957            ON(fatal, pFileLoc, _("enmType=%d"), enmType);
    958958            return -1;
    959959    }
     
    974974            /* Inheritance directive. */
    975975            if (pObj->pszParent != NULL)
    976                 fatal(pFileLoc, _("'extending' can only occure once"));
     976                O(fatal, pFileLoc, _("'extending' can only occure once"));
    977977            pObj->pszParent = allocate_expanded_next_token(&pszLine, pszEos, &pObj->cchParent, 1 /*strip*/);
    978978            if (!pObj->pszParent || !*pObj->pszParent)
    979                 fatal(pFileLoc, _("'extending' requires a parent name"));
     979                O(fatal, pFileLoc, _("'extending' requires a parent name"));
    980980        }
    981981        else if (WORD_IS(psz, cch, "using"))
     
    986986            /* Template directive. */
    987987            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'"));
    989989            if (pObj->pszTemplate != NULL)
    990                 fatal(pFileLoc, _("'using' can only occure once"));
     990                O(fatal, pFileLoc, _("'using' can only occure once"));
    991991
    992992            pszTemplate = allocate_expanded_next_token(&pszLine, pszEos, &cchTemplate, 1 /*fStrip*/);
    993993            if (!pszTemplate || !*pszTemplate)
    994                 fatal(pFileLoc, _("'using' requires a template name"));
     994                O(fatal, pFileLoc, _("'using' requires a template name"));
    995995
    996996            define_kbuild_object_variable_cached(pObj, g_pszVarNmTemplate, pszTemplate, cchTemplate,
     
    10001000        }
    10011001        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);
    10031003
    10041004        /* next token */
     
    10271027
    10281028static int
    1029 eval_kbuild_endef_xxxx(struct kbuild_eval_data **ppData, const struct floc *pFileLoc,
     1029eval_kbuild_endef_xxxx(struct kbuild_eval_data **ppData, const floc *pFileLoc,
    10301030                       const char *pszLine, const char *pszEos, int fIgnoring, enum kBuildType enmType)
    10311031{
     
    10441044    if (!pData)
    10451045    {
    1046         error(pFileLoc, _("kBuild-endef-%s is missing kBuild-define-%s"),
    1047               eval_kbuild_type_to_string(enmType), eval_kbuild_type_to_string(enmType));
     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));
    10481048        return 0;
    10491049    }
     
    10541054    pObj = pData->pObj;
    10551055    if (pObj->enmType != enmType)
    1056         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);
     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);
    10581058
    10591059    /*
     
    10661066        if (   cchName != pObj->cchName
    10671067            || 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'"),
    10691069                  eval_kbuild_type_to_string(enmType), pszName,
    10701070                  eval_kbuild_type_to_string(pObj->enmType), pObj->pszName);
     
    10851085}
    10861086
    1087 int eval_kbuild_read_hook(struct kbuild_eval_data **kdata, const struct floc *flocp,
     1087int eval_kbuild_read_hook(struct kbuild_eval_data **kdata, const floc *flocp,
    10881088                          const char *pchWord, size_t cchWord, const char *line, const char *eos, int ignoring)
    10891089{
     
    11241124     * extensions, at least until legacy assignments/whatever turns up.
    11251125     */
    1126     error(flocp, _("Unknown syntax 'kBuild-%.*s'"), (int)cchWord, pchWord);
     1126    error(flocp, cchWord, _("Unknown syntax 'kBuild-%.*s'"), (int)cchWord, pchWord);
    11271127    return 0;
    11281128}
     
    11891189static struct kbuild_object *
    11901190parse_kbuild_object_variable_accessor(const char *pchExpr, size_t cchExpr,
    1191                                       enum kBuildSeverity enmSeverity, const struct floc *pFileLoc,
     1191                                      enum kBuildSeverity enmSeverity, const floc *pFileLoc,
    11921192                                      const char **ppchVarNm, size_t *pcchVarNm, enum kBuildType *penmType)
    11931193{
     
    13951395        putchar('\n');
    13961396
    1397         print_variable_set(pCur->pVariables->set, "");
     1397        print_variable_set(pCur->pVariables->set, "", 0);
    13981398
    13991399        printf("kBuild-endef-%s  %s\n",
Note: See TracChangeset for help on using the changeset viewer.