VirtualBox

Changeset 2797 in kBuild for trunk/src/kmk/kmk_cc_exec.c


Ignore:
Timestamp:
Sep 19, 2015 3:35:39 PM (10 years ago)
Author:
bird
Message:

kmk_cc_exec.c: gcc build fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kmk_cc_exec.c

    r2790 r2797  
    110110# define KMK_CC_STATIC_ASSERT_EX(a_Expr, a_szExpl)  typedef int KMK_CC_STATIC_ASSERT_EX_TYPE[(a_Expr) ? 1 : 0]
    111111#else
    112 # define KMK_CC_STATIC_ASSERT_EX(a_Expr, a_szExpl)  extern int KMK_CC_STATIC_ASSERT_EX_VAR[(aExpr) ? 1 : 0]
     112# define KMK_CC_STATIC_ASSERT_EX(a_Expr, a_szExpl)  extern int KMK_CC_STATIC_ASSERT_EX_VAR[(a_Expr) ? 1 : 0]
    113113extern int KMK_CC_STATIC_ASSERT_EX_VAR[1];
    114114#endif
     
    20272027
    20282028                        /* First loop: Identify potential function calls and dynamic expansion. */
    2029                         KMK_CC_ASSERT(!func_char_map[chOpen]);
    2030                         KMK_CC_ASSERT(!func_char_map[chClose]);
    2031                         KMK_CC_ASSERT(!func_char_map['$']);
     2029                        KMK_CC_ASSERT(!func_char_map[(unsigned char)chOpen]);
     2030                        KMK_CC_ASSERT(!func_char_map[(unsigned char)chClose]);
     2031                        KMK_CC_ASSERT(!func_char_map[(unsigned char)'$']);
    20322032                        while (cchName < cchStr)
    20332033                        {
    20342034                            ch = pchStr[cchName];
    2035                             if (!func_char_map[(int)ch])
     2035                            if (!func_char_map[(unsigned char)ch])
    20362036                                break;
    20372037                            cchName++;
     
    20922092                            if (cArgs < cMinArgs)
    20932093                            {
    2094                                 fatal(NULL, _("Function '%.*s' takes a minimum of %d arguments: %d given"),
     2094                                fatal(NULL, _("Function '%s' takes a minimum of %d arguments: %d given"),
    20952095                                      pszFunction, (int)cMinArgs, (int)cArgs);
    20962096                                return -1; /* not reached */
     
    22782278    if (pProg)
    22792279    {
    2280         int rc = 0;
    2281 
    22822280        pProg->pBlockTail   = pBlock;
    22832281        pProg->pFirstInstr  = (PKMKCCEXPCORE)kmk_cc_block_get_next_ptr(pBlock);
     
    28142812
    28152813
     2814#if 0
    28162815/**
    28172816 * Checks whether we've got an EOL escape sequence or not.
     
    28352834    return (offEol - offFirstBackslash) & 1;
    28362835}
     2836#endif
    28372837
    28382838
     
    31473147 */
    31483148#if defined(KBUILD_ARCH_X86) || defined(KBUILD_ARCH_AMD64) /* Unaligned access is reasonably cheap. */
    3149 # define KMK_CC_WORD_COMP_CONST_0(a_pchLine, a_pszWord) (1)
    31503149# define KMK_CC_WORD_COMP_CONST_2(a_pchLine, a_pszWord) \
    31513150        (   *(uint16_t const *)(a_pchLine)     == *(uint16_t const *)(a_pszWord) )
     
    31743173         && ((uint64_t const *)(a_pchLine))[1] == ((uint64_t const *)(a_pszWord))[1] )
    31753174#else
    3176 # define KMK_CC_WORD_COMP_CONST_0(a_pchLine, a_pszWord) (1)
    31773175# define KMK_CC_WORD_COMP_CONST_2(a_pchLine, a_pszWord) \
    31783176        (   (a_pchLine)[0] == (a_pszWord)[0] \
     
    32463244         && (a_pchLine)[15] == (a_pszWord)[15])
    32473245#endif
     3246/** See if a starting of a given length starts with a constant word. */
     3247#define KMK_CC_WORD_COMP_IS_EOL(a_pCompiler, a_pchLine, a_cchLine) \
     3248    (   (a_cchLine) == 0 \
     3249     || KMK_CC_EVAL_IS_SPACE((a_pchLine)[0]) \
     3250     || ((a_pchLine)[0] == '\\' && (a_pchLine)[1] == (a_pCompiler)->chFirstEol) ) \
     3251
    32483252/** See if a starting of a given length starts with a constant word. */
    32493253#define KMK_CC_WORD_COMP_CONST(a_pCompiler, a_pchLine, a_cchLine, a_pszWord, a_cchWord) \
     
    37013705
    37023706
     3707#if 0  /* unused atm */
    37033708/**
    37043709 * Prepares for copying a command line.
     
    38213826    }
    38223827}
     3828#endif /* unused atm */
    38233829
    38243830
     
    38973903    unsigned const  cEscEols = pCompiler->cEscEols;
    38983904
    3899     KMK_CC_ASSERT(cchLeft >= 0);
    39003905    KMK_CC_ASSERT(iEscEol <= cEscEols);
    39013906
     
    43234328//            unsigned cCounts;
    43244329
     4330
     4331
    43254332            /* Skip the parenthesis. */
    43264333            pchWord++;
     
    44684475            cchLeft -= 2;
    44694476
    4470             if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "", 0))
     4477            if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
    44714478                return kmk_cc_eval_do_if(pCompiler, pchWord, cchLeft, 1 /* in else */);
    44724479
     
    47964803        if (ch2 == 'f')
    47974804        {
    4798             if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "", 0))
     4805            if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
    47994806                return kmk_cc_eval_do_if(pCompiler, pchWord, cchLeft, 0 /* in else */);
    48004807
     
    48224829            pchWord += 5;
    48234830            cchLeft -= 5;
    4824             if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "", 0))
     4831            if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
    48254832                return kmk_cc_eval_do_include(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_include);
    48264833            if (cchLeft >= 3 && KMK_CC_WORD_COMP_CONST_3(pchWord, "dep"))
     
    48284835                pchWord += 3;
    48294836                cchLeft -= 3;
    4830                 if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "", 0))
     4837                if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
    48314838                    return kmk_cc_eval_do_include(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_includedep);
    48324839                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-queue", 6))
     
    49204927                    if (&pszContent[offNext] == pchTmp)
    49214928                    {
    4922 fprintf(stderr, "#%03u: <empty>\n", Compiler.iLine, &pszContent[off]);
     4929fprintf(stderr, "#%03u: <empty>\n", Compiler.iLine);
    49234930                        Compiler.iLine++;
    49244931                        off = offNext += cchEolSeq;
     
    49274934                    if (pszContent[offNext] == '#')
    49284935                    {
    4929 fprintf(stderr, "#%03u: <comment>\n", Compiler.iLine, &pszContent[off]);
     4936fprintf(stderr, "#%03u: <comment>\n", Compiler.iLine);
    49304937                        Compiler.iLine++;
    49314938                        offNext = pchTmp - pszContent;
     
    49594966                    {
    49604967                        size_t offEol = off + cchLine;
    4961                         while (offFirstWord < off + cchLine && KMK_CC_EVAL_IS_SPACE(pszContent[offFirstWord]))
     4968                        while (offFirstWord < offEol && KMK_CC_EVAL_IS_SPACE(pszContent[offFirstWord]))
    49624969                            offFirstWord++;
    49634970                    }
     
    51395146    if (pEvalProg)
    51405147    {
    5141         int rc = 0;
    5142 
    51435148        pEvalProg->pBlockTail   = pBlock;
    51445149        pEvalProg->pFirstInstr  = (PKMKCCEVALCORE)kmk_cc_block_get_next_ptr(pBlock);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette