< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] gperf tidy up



Just added to the master branch:

Using a new directory resip/stack/gen/ for all the generated files.

When a travis-ci build starts, it deletes any content in that directory:
    rm resip/stack/gen/*
to guarantee that gperf is re-run and all test cases are then executed
against freshly generated code.  This will hopefully ensure we catch any
faults in the gperf files or any faults in a future version of gperf
itself or the way some future compiler handles gperf output.




On the gperf-fixes branch, I've moved generated code out of
DateCategory.cxx into DayOfMonthHash.cxx and MonthHash.cxx

- Why?  The sets of values are unlikely to change (unless somebody adds
an 8th day to give us 3 day weekends?).  However, it is useful to
exercise the gperf utility on every CI build, maybe future versions will
be more efficient or offer some other benefit.

- code comments: gperf output includes a comment with the exact command
line.  It said:
  /* ANSI-C code produced by gperf version 2.7.2 */
  /* Command-line: gperf -L ANSI-C -t -k '*' dayofweek.gperf  */
but the code that was in DateCategory.cxx was generated with some
additional options:
   -H dayofweek_hash \
   -N in_dayofweek_word_set \
   --compare-strncmp
so it looks like gperf output had been modified/selectively cut and
pasted and the comment not updated at the same time.

- using C++ inline: the gperf code was generated using the ANSI-C output
style but I've changed it to the C++ style.  Using the ANSI-C output was
causing problems with the way the inline modifier works on some
builds[1] (e.g. with -O0 it will fail in g++ builds).  Now it is
consistent with the other *Hash.cxx code.

Regards,

Daniel


1. http://lists.gnu.org/archive/html/bug-gperf/2009-09/msg00002.html