VirtualBox

Changeset 1980 in kBuild


Ignore:
Timestamp:
Oct 27, 2008 11:25:49 PM (16 years ago)
Author:
bird
Message:

kmk: Some cleanup.

Location:
trunk/src/kmk
Files:
11 edited

Legend:

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

    r1954 r1980  
    413413
    414414  cmds->any_recurse = 0;
    415 #ifdef CONFIG_WITH_COMMANDS_FUNC
     415#ifndef CONFIG_WITH_COMMANDS_FUNC
     416  cmds->lines_flags = xmalloc (nlines);
     417#else
    416418  cmds->lines_flags = xmalloc (nlines * sizeof (cmds->lines_flags[0]));
    417 #else
    418   cmds->lines_flags = xmalloc (nlines);
    419419#endif
    420420  for (idx = 0; idx < nlines; ++idx)
     
    423423
    424424      for (p = lines[idx];
    425 #ifdef CONFIG_WITH_COMMANDS_FUNC
     425#ifndef CONFIG_WITH_COMMANDS_FUNC
     426            isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+';
     427#else
    426428           isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+' || *p == '%';
    427 #else
    428            isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+';
    429429#endif
    430430           ++p)
     
    536536  exit (10);
    537537#else /* not Amiga */
    538 #if defined(WINDOWS32) && !defined(CONFIG_NEW_WIN32_CTRL_EVENT)
     538#if defined (WINDOWS32) && !defined (CONFIG_NEW_WIN32_CTRL_EVENT)
    539539  extern HANDLE main_thread;
    540540
     
    618618
    619619#ifdef WINDOWS32
    620 #ifndef CONFIG_NEW_WIN32_CTRL_EVENT
     620# ifndef CONFIG_NEW_WIN32_CTRL_EVENT
    621621  if (main_thread)
    622622    CloseHandle (main_thread);
    623 #endif /* !CONFIG_NEW_WIN32_CTRL_EVENT */
     623# endif /* !CONFIG_NEW_WIN32_CTRL_EVENT */
    624624  /* Cannot call W32_kill with a pid (it needs a handle).  The exit
    625625     status of 130 emulates what happens in Bash.  */
  • trunk/src/kmk/dep.h

    r1863 r1980  
    5959
    6060
    61 
    6261#ifndef CONFIG_WITH_ALLOC_CACHES
    6362struct nameseq *multi_glob (struct nameseq *chain, unsigned int size);
  • trunk/src/kmk/dir.c

    r1941 r1980  
    220220#ifndef DIRECTORY_BUCKETS
    221221#ifdef KMK
    222 # define DIRECTORY_BUCKETS 4096
     222#  define DIRECTORY_BUCKETS 4096
    223223# else
    224 #define DIRECTORY_BUCKETS 199
     224#  define DIRECTORY_BUCKETS 199
    225225# endif
    226226#endif
     
    10161016#endif
    10171017      memset (dir->contents, '\0', sizeof (struct directory_contents));
    1018 
    10191018    }
    10201019
     
    12391238              files += f;
    12401239              impossible += im;
    1241 
    12421240#ifdef KMK
    12431241              fputs ("# ", stdout);
     
    13911389  gl->gl_closedir = ansi_free;
    13921390  gl->gl_stat = local_stat;
    1393 #ifdef __EMX__ /* The FreeBSD implemenation actually uses gl_lstat!! */
     1391#ifdef __EMX__ /* The FreeBSD implementation actually uses gl_lstat!! */
    13941392  gl->gl_lstat = local_stat;
    13951393#endif
     
    14041402  hash_init (&directories, DIRECTORY_BUCKETS,
    14051403             directory_hash_1, directory_hash_2, directory_hash_cmp);
    1406 #else  /* */
     1404#else  /* CONFIG_WITH_STRCACHE2 */
    14071405  hash_init_strcached (&directories, DIRECTORY_BUCKETS, &file_strcache,
    14081406                       offsetof (struct directory, name));
    1409 #endif /* */
     1407#endif /* CONFIG_WITH_STRCACHE2 */
    14101408  hash_init (&directory_contents, DIRECTORY_BUCKETS,
    14111409             directory_contents_hash_1, directory_contents_hash_2,
     
    14181416  alloccache_init (&dirfile_cache, sizeof (struct dirfile),
    14191417                   "dirfile", NULL, NULL);
    1420 #endif
    1421 }
     1418#endif /* CONFIG_WITH_ALLOC_CACHES */
     1419}
  • trunk/src/kmk/expand.c

    r1975 r1980  
    8181      unsigned int offset = ptr - variable_buffer;
    8282      variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length
    83                                ? newlen + 100
    84                                : 2 * variable_buffer_length);
     83                                ? newlen + 100
     84                                : 2 * variable_buffer_length);
    8585      variable_buffer = xrealloc (variable_buffer, variable_buffer_length);
    8686      ptr = variable_buffer + offset;
     
    116116      variable_buffer[0] = '\0';
    117117    }
    118 #else
     118#else  /* CONFIG_WITH_VALUE_LENGTH */
    119119  if (variable_buffer == 0)
    120120    {
     
    123123      variable_buffer[0] = '\0';
    124124    }
    125 #endif
     125#endif /* CONFIG_WITH_VALUE_LENGTH */
    126126
    127127  return variable_buffer;
     
    210210/* Expand a simple reference to variable NAME, which is LENGTH chars long.  */
    211211
    212 #if defined(__GNUC__) || defined(_MSC_VER) /* bird added MSC */
     212#if defined(__GNUC__)
    213213__inline
     214#elif defined (MY_INLINE) /* bird */
     215MY_INLINE
    214216#endif
    215217static char *
     
    236238     unsigned int value_len;
    237239
     240     /* XXX: Inline recursively_expand_for_file() here and what it calls, try
     241             make use of O directly instead wasting time on an intermediate buffer.  */
    238242     value = recursively_expand_for_file (v, NULL, &value_len);
    239243     o = variable_buffer_output (o, value, value_len);
     
    760764#ifndef CONFIG_WITH_VALUE_LENGTH
    761765  return variable_expand_string(NULL, line, (long)-1);
    762 #else
     766#else  /* CONFIG_WITH_VALUE_LENGTH */
    763767  char *s;
    764768
     
    770774    }
    771775  return variable_expand_string_2 (NULL, line, (long)-1, &s);
    772 #endif
     776#endif /* CONFIG_WITH_VALUE_LENGTH */
    773777}
    774778
     
    793797  if (!end || *end == '\0')
    794798    return allocated_variable_expand (str);
     799
    795800  tmp = alloca (end - str + 1);
    796801  memcpy (tmp, str, end - str);
    797802  tmp[end - str] = '\0';
     803
    798804  return allocated_variable_expand (tmp);
    799805#else  /* CONFIG_WITH_VALUE_LENGTH */
     
    844850{
    845851  char *result;
    846   struct variable_set_list *save;
    847   const struct floc *reading_file_saved;
     852  struct variable_set_list *savev;
     853  const struct floc *savef;
    848854  long len = length == ~0U ? (long)-1 : (long)length;
    849855  char *eol;
     
    856862  else
    857863    {
    858       save = current_variable_set_list;
     864      savev = current_variable_set_list;
    859865      current_variable_set_list = file->variables;
    860       reading_file_saved = reading_file;
     866
     867      savef = reading_file;
    861868      if (file->cmds && file->cmds->fileinfo.filenm)
    862869        reading_file = &file->cmds->fileinfo;
    863870      else
    864871        reading_file = 0;
     872
    865873      result = variable_expand_string_2 (o, line, len, &eol);
    866       current_variable_set_list = save;
    867       reading_file = reading_file_saved;
     874
     875      current_variable_set_list = savev;
     876      reading_file = savef;
    868877    }
    869878
     
    10061015  variable_buffer = 0;
    10071016
    1008   assert ((unsigned int)v->length == strlen (v->name));
     1017  assert ((unsigned int)v->length == strlen (v->name)); /* bird */
    10091018  val = variable_append (v->name, strlen (v->name), current_variable_set_list);
    10101019  variable_buffer_output (val, "", 1);
  • trunk/src/kmk/file.c

    r1975 r1980  
    538538        multi_glob (parse_file_seq (&p, '\0', &dep_cache, 1), &dep_cache);
    539539#endif
     540
    540541      if (! new)
    541542        new = ood;
     
    858859     and thereby save a little time.  */
    859860  incdep_flush_and_term ();
    860 #endif
     861#endif /* CONFIG_WITH_INCLUDEDEP */
    861862
    862863  /* For every target that's not .SUFFIXES, expand its dependencies.
     
    887888      for (f2 = f->double_colon; f2 != 0; f2 = f2->prev)
    888889        f2->command_flags |= COMMANDS_NOTPARALLEL;
    889 #endif
     890#endif /* KMK */
    890891  free (file_slot_0);
    891892
     
    13831384  hash_init (&files, 1000, file_hash_1, file_hash_2, file_hash_cmp);
    13841385# endif
    1385 #else
     1386#else  /* CONFIG_WITH_STRCACHE2 */
    13861387# ifdef KMK
    13871388  hash_init_strcached (&files, 32755, &file_strcache,
     
    13911392                       offsetof (struct file, hname));
    13921393# endif
    1393 #endif
     1394#endif /* CONFIG_WITH_STRCACHE2 */
    13941395}
    13951396
  • trunk/src/kmk/filedef.h

    r1975 r1980  
    211211#define ORDINARY_MTIME_MAX ((FILE_TIMESTAMP_S (NEW_MTIME) \
    212212                             << FILE_TIMESTAMP_LO_BITS) \
    213                             + ORDINARY_MTIME_MIN + (FILE_TIMESTAMPS_PER_S - 1)) /* bird: MSC overflow fix */
     213                            + ORDINARY_MTIME_MIN + (FILE_TIMESTAMPS_PER_S - 1)) /* bird: MSC overflow fix - XXX: darwin is bitching, check it again, org: ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S - 1) */
    214214
    215215/* Modtime value to use for `infinitely new'.  We used to get the current time
  • trunk/src/kmk/function.c

    r1972 r1980  
    340340/* Do the hash table lookup. */
    341341
    342 __inline static const struct function_table_entry *
     342MY_INLINE const struct function_table_entry *
    343343lookup_function_in_hash_tab (const char *s, unsigned char len)
    344344{
     
    352352/* Look up a function by name.  */
    353353
    354 __inline static const struct function_table_entry *
     354MY_INLINE const struct function_table_entry *
    355355lookup_function (const char *s, unsigned int len)
    356356{
     
    517517                       0),
    518518                      sizeof (struct nameseq));
    519 #else
     519#else  /* CONFIG_WITH_ALLOC_CACHES */
    520520  chain = multi_glob (parse_file_seq
    521521                      (&line, '\0', &nameseq_cache,
     
    525525                       0),
    526526                      &nameseq_cache);
    527 #endif
     527#endif /* CONFIG_WITH_ALLOC_CACHES */
    528528
    529529  if (result == 0)
     
    10321032      free (var->value);
    10331033      var->value = savestring (p, len);
     1034
    10341035      result = allocated_variable_expand (body);
    10351036
  • trunk/src/kmk/hash.h

    r1902 r1980  
    100100/* hash and comparison macros for case-sensitive string keys. */
    101101
    102 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS
    103102#define STRING_HASH_1(KEY, RESULT) do { \
    104103  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    106105    (RESULT) += (*_key_ << (_key_[1] & 0xf)); \
    107106} while (0)
    108 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    109 # define STRING_HASH_1(KEY, RESULT) do { \
    110   unsigned char const *_key_ = (unsigned char const *) (KEY); \
    111   unsigned int _ch_ = *_key_; \
    112   while (_ch_) \
    113     { \
    114       unsigned char _ch2_ = *++_key_; \
    115      (RESULT) += (_ch_ << (_ch2_ & 0xf)); \
    116      _ch_ = _ch2_; \
    117     } \
    118 } while (0)
    119 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    120107#define return_STRING_HASH_1(KEY) do { \
    121108  unsigned long _result_ = 0; \
     
    124111} while (0)
    125112
    126 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS
    127113#define STRING_HASH_2(KEY, RESULT) do { \
    128114  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    130116    (RESULT) += (*_key_ << (_key_[1] & 0x7)); \
    131117} while (0)
    132 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    133 # define STRING_HASH_2(KEY, RESULT) do { \
    134   unsigned char const *_key_ = (unsigned char const *) (KEY); \
    135   unsigned int _ch_ = *_key_; \
    136   while (_ch_) \
    137     { \
    138       unsigned char _ch2_ = *++_key_; \
    139      (RESULT) += (_ch_ << (_ch2_ & 0x7)); \
    140      _ch_ = _ch2_; \
    141     } \
    142 } while (0)
    143 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    144118#define return_STRING_HASH_2(KEY) do { \
    145119  unsigned long _result_ = 0; \
     
    155129} while (0)
    156130
    157 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS
     131
    158132#define STRING_N_HASH_1(KEY, N, RESULT) do { \
    159133  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    164138  (RESULT) += *++_key_; \
    165139} while (0)
    166 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    167 # define STRING_N_HASH_1(KEY, N, RESULT) do { \
    168   unsigned char const *_key_ = (unsigned char const *) (KEY); \
    169   unsigned int _ch_ = *_key_; \
    170   int _n_ = (N); \
    171   if (_n_) \
    172     { \
    173       for (;;) \
    174         { \
    175           unsigned char _ch2_; \
    176           if (!--_n_) \
    177             { \
    178               (RESULT) += _ch_; \
    179               break; \
    180             } \
    181           _ch2_ = *++_key_; \
    182           (RESULT) += (_ch_ << (_ch2_ & 0xf)); \
    183           _ch_ = _ch2_; \
    184           if (!_ch_) break; \
    185         } \
    186     } \
    187   else \
    188     (RESULT) += _ch_; \
    189 } while (0)
    190 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    191140#define return_STRING_N_HASH_1(KEY, N) do { \
    192141  unsigned long _result_ = 0; \
     
    195144} while (0)
    196145
    197 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS
    198146#define STRING_N_HASH_2(KEY, N, RESULT) do { \
    199147  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    204152  (RESULT) += *++_key_; \
    205153} while (0)
    206 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    207 # define STRING_N_HASH_2(KEY, N, RESULT) do { \
    208   unsigned char const *_key_ = (unsigned char const *) (KEY); \
    209   unsigned int _ch_ = *_key_; \
    210   int _n_ = (N); \
    211   if (_n_) \
    212     { \
    213       for (;;) \
    214         { \
    215           unsigned char _ch2_; \
    216           if (!--_n_) \
    217             { \
    218               (RESULT) += _ch_; \
    219               break; \
    220             } \
    221           _ch2_ = *++_key_; \
    222           (RESULT) += (_ch_ << (_ch2_ & 0x7)); \
    223           _ch_ = _ch2_; \
    224           if (!_ch_) break; \
    225         } \
    226     } \
    227   else \
    228     (RESULT) += _ch_; \
    229 } while (0)
    230 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    231154#define return_STRING_N_HASH_2(KEY, N) do { \
    232155  unsigned long _result_ = 0; \
     
    246169/* hash and comparison macros for case-insensitive string _key_s. */
    247170
    248 #if 1 /*ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */
    249171#define ISTRING_HASH_1(KEY, RESULT) do { \
    250172  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    252174    (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0xf)); \
    253175} while (0)
    254 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    255 #define ISTRING_HASH_1(KEY, RESULT) do { \
    256   unsigned char const *_key_ = (unsigned char const *) (KEY); \
    257   unsigned int _ch_ = *_key_;
    258   while (_ch_) \
    259     { \
    260       unsigned _ch2_ = *++_key_; \
    261       (RESULT) += ((isupper (_ch_) ? tolower (_ch_) : _ch_) << (_ch2_ & 0xf)); \
    262       _ch_ = _ch2_; \
    263     } \
    264 } while (0)
    265 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    266176#define return_ISTRING_HASH_1(KEY) do { \
    267177  unsigned long _result_ = 0; \
     
    270180} while (0)
    271181
    272 #if 1 /* ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */
    273182#define ISTRING_HASH_2(KEY, RESULT) do { \
    274183  unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \
     
    276185    (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0x7)); \
    277186} while (0)
    278 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */
    279 #define ISTRING_HASH_2(KEY, RESULT) do { \
    280   unsigned char const *_key_ = (unsigned char const *) (KEY); \
    281   unsigned int _ch_ = *_key_;
    282   while (_ch_) \
    283     { \
    284       unsigned _ch2_ = *++_key_; \
    285       (RESULT) += ((isupper (_ch_) ? tolower (_ch_) : _ch_) << (_ch2_ & 0x7)); \
    286       _ch_ = _ch2_; \
    287     } \
    288 } while (0)
    289 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */
    290187#define return_ISTRING_HASH_2(KEY) do { \
    291188  unsigned long _result_ = 0; \
  • trunk/src/kmk/job.c

    r1440 r1980  
    780780                message (0, "The failing command:\n%s", c->file->cmds->command_lines[c->command_line - 1]);
    781781            }
    782 #else
     782#else  /* !KMK */
    783783            child_error (c->file->name, exit_code, exit_sig, coredump, 0);
    784 #endif
     784#endif /* !KMK */
    785785
    786786          c->file->update_status = 2;
     
    10591059      else if (*p == '%')
    10601060        flags |= COMMAND_GETTER_SKIP_IT;
    1061 #endif 
     1061#endif
    10621062      else if (!isblank ((unsigned char)*p))
    10631063#ifndef CONFIG_WITH_KMK_BUILTIN
     
    12351235        }
    12361236
    1237 #ifndef VMS
     1237# ifndef VMS
    12381238      free (argv[0]);
    12391239      free ((char *) argv);
    1240 #endif
     1240# endif
    12411241
    12421242      /* synchronous command execution? */
     
    28202820                      && !isspace ((unsigned char)p[1])
    28212821# ifdef KMK
    2822                       && strchr (sh_chars, p[1]) == 0 
     2822                      && strchr (sh_chars, p[1]) == 0
    28232823                      && (p[1] != '"' || !unixy_shell))
    28242824# else
    28252825                      && strchr (sh_chars_sh, p[1]) == 0)
    2826 # endif 
     2826# endif
    28272827                    /* back up one notch, to copy the backslash */
    28282828                    --p;
  • trunk/src/kmk/main.c

    r1968 r1980  
    679679  alloccache_init (&variable_set_list_cache, sizeof (struct variable_set_list), "variable_set_list", NULL, NULL);
    680680}
    681 #endif
     681#endif /* CONFIG_WITH_ALLOC_CACHES */
    682682
    683683static void
     
    787787              db_level |= DB_KMK;
    788788              break;
    789 #endif
     789#endif /* DB_KMK */
    790790            default:
    791791              fatal (NILF, _("unknown debug level specification `%s'"), p);
     
    809809set_make_priority_and_affinity (void)
    810810{
    811 #ifdef WINDOWS32
     811# ifdef WINDOWS32
    812812  DWORD dwPriority;
    813813  if (process_affinity)
     
    830830             dwPriority, GetLastError ());
    831831
    832 #else /*#elif HAVE_NICE */
     832# else /*#elif HAVE_NICE */
    833833  int nice_level = 0;
    834834  switch (process_priority)
     
    846846    fprintf (stderr, "warning: nice (%d) failed: %s\n",
    847847             nice_level, strerror (errno));
    848 #endif
     848# endif
    849849}
    850 #endif
     850#endif /* KMK */
    851851
    852852
     
    12871287#if defined(set_space_map_entry) /*bird*/
    12881288char space_map[space_map_size];
    1289 #endif
     1289#endif /* set_space_map_entry */
    12901290
    12911291
     
    13071307  char *windows32_path = NULL;
    13081308
    1309 #ifndef ELECTRIC_HEAP /* Drop this because it prevent JIT debugging. */
     1309#ifndef ELECTRIC_HEAP /* Drop this because it prevents JIT debugging. */
    13101310  SetUnhandledExceptionFilter(handle_runtime_exceptions);
    13111311#endif /* !ELECTRIC_HEAP */
  • trunk/src/kmk/read.c

    r1977 r1980  
    175175static char *find_char_unquote (char *string, int stop1, int stop2,
    176176                                int blank, int ignorevars);
    177 #else
     177#else  /* CONFIG_WITH_VALUE_LENGTH */
    178178__inline static char *remove_comments (char *line, char *eol);
    179179__inline static char *find_char_unquote_0 (char *string, int stop1, char **eosp);
     
    181181                                   int blank, int ignorevars,
    182182                                   unsigned int string_len);
    183 __inline static char *
     183MY_INLINE char *
    184184find_char_unquote (char *string, int stop1, int stop2, int blank, int ignorevars)
    185185{
     
    195195    return find_char_unquote_2 (string, stop1, stop2, blank, ignorevars, 0);
    196196}
    197 #endif
     197#endif /* CONFIG_WITH_VALUE_LENGTH */
    198198
    199199
Note: See TracChangeset for help on using the changeset viewer.

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