summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-01-07 01:40:49 +0000
committerpfg <pfg@FreeBSD.org>2014-01-07 01:40:49 +0000
commitdf0886c3c28f12466a415b9960ccbf4b6f882541 (patch)
tree505d37f1d4a9c53f780b1bbaaf3f9b154cc4a922
parent7f18e0f33d9b8aa075e68652dd90c5da9cd49677 (diff)
downloadFreeBSD-src-df0886c3c28f12466a415b9960ccbf4b6f882541.zip
FreeBSD-src-df0886c3c28f12466a415b9960ccbf4b6f882541.tar.gz
gperf: reverse size_type patch from r258115.
Silencing the broken warning as done in r258139 renders the code unreacheable. An option could've been to turn off the warnings in gperf but given that the code is not being used it is better to just revert the original change altogether. This code was never MFC'd.
-rw-r--r--contrib/gperf/doc/gperf.18
-rw-r--r--contrib/gperf/src/options.cc21
-rw-r--r--contrib/gperf/src/options.h5
-rw-r--r--contrib/gperf/src/options.icc6
-rw-r--r--contrib/gperf/src/output.cc27
5 files changed, 16 insertions, 51 deletions
diff --git a/contrib/gperf/doc/gperf.1 b/contrib/gperf/doc/gperf.1
index 217969f..786604e 100644
--- a/contrib/gperf/doc/gperf.1
+++ b/contrib/gperf/doc/gperf.1
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
-.TH GPERF "1" "October 2011" "GNU gperf 3.0.3" FSF
+.TH GPERF "1" "May 2007" "GNU gperf 3.0.3" FSF
.SH NAME
-gperf \- manual page for gperf 3.0.3
+gperf \- generate a perfect hash function from a key set
.SH SYNOPSIS
.B gperf
[\fIOPTION\fR]... [\fIINPUT-FILE\fR]
@@ -129,10 +129,6 @@ binary search.
Prevents the transfer of the type declaration to the
output file. Use this option if the type is already
defined elsewhere.
-.TP
-\fB\-\-size\-type\fR=\fITYPE\fR
-Specify the type for length parameters. Default type is
-\&'unsigned int'.
.SS "Algorithm employed by gperf:"
.TP
\fB\-k\fR, \fB\-\-key\-positions\fR=\fIKEYS\fR
diff --git a/contrib/gperf/src/options.cc b/contrib/gperf/src/options.cc
index e413427..a799b5a 100644
--- a/contrib/gperf/src/options.cc
+++ b/contrib/gperf/src/options.cc
@@ -67,8 +67,6 @@ static const char *const DEFAULT_STRINGPOOL_NAME = "stringpool";
/* Default delimiters that separate keywords from their attributes. */
static const char *const DEFAULT_DELIMITERS = ",";
-static const char *const DEFAULT_SIZE_TYPE = "unsigned int";
-
/* Prints program usage to given stream. */
void
@@ -204,9 +202,6 @@ Options::long_usage (FILE * stream)
" Prevents the transfer of the type declaration to the\n"
" output file. Use this option if the type is already\n"
" defined elsewhere.\n");
- fprintf (stream,
- " --size-type=TYPE Specify the type for length parameters. Default type is\n"
- " 'unsigned int'.\n");
fprintf (stream, "\n");
fprintf (stream,
"Algorithm employed by gperf:\n");
@@ -475,7 +470,6 @@ Options::Options ()
_lengthtable_name (DEFAULT_LENGTHTABLE_NAME),
_stringpool_name (DEFAULT_STRINGPOOL_NAME),
_delimiters (DEFAULT_DELIMITERS),
- _size_type (DEFAULT_SIZE_TYPE),
_key_positions ()
{
}
@@ -520,7 +514,6 @@ Options::~Options ()
"\nhash table size multiplier = %g"
"\ninitial associated value = %d"
"\ndelimiters = %s"
- "\nsize type = %s"
"\nnumber of switch statements = %d\n",
_option_word & TYPE ? "enabled" : "disabled",
_option_word & UPPERLOWER ? "enabled" : "disabled",
@@ -546,7 +539,7 @@ Options::~Options ()
_function_name, _hash_name, _wordlist_name, _lengthtable_name,
_stringpool_name, _slot_name, _initializer_suffix,
_asso_iterations, _jump, _size_multiple, _initial_asso_value,
- _delimiters, _size_type, _total_switches);
+ _delimiters, _total_switches);
if (_key_positions.is_useall())
fprintf (stderr, "all characters are used in the hash function\n");
else
@@ -675,12 +668,6 @@ Options::set_delimiters (const char *delimiters)
_delimiters = delimiters;
}
-void
-Options::set_size_type (const char *size_type)
-{
- if (_size_type == DEFAULT_SIZE_TYPE)
- _size_type = size_type;
-}
/* Parses the command line Options and sets appropriate flags in option_word. */
@@ -706,7 +693,6 @@ static const struct option long_options[] =
{ "global-table", no_argument, NULL, 'G' },
{ "word-array-name", required_argument, NULL, 'W' },
{ "length-table-name", required_argument, NULL, CHAR_MAX + 4 },
- { "size-type", required_argument, NULL, CHAR_MAX + 5 },
{ "switch", required_argument, NULL, 'S' },
{ "omit-struct-type", no_argument, NULL, 'T' },
{ "key-positions", required_argument, NULL, 'k' },
@@ -1060,11 +1046,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
_lengthtable_name = /*getopt*/optarg;
break;
}
- case CHAR_MAX + 5: /* Sets the name for the length table array. */
- {
- _size_type = /*getopt*/optarg;
- break;
- }
default:
short_usage (stderr);
exit (1);
diff --git a/contrib/gperf/src/options.h b/contrib/gperf/src/options.h
index 2ca2b3b..bda7f0c 100644
--- a/contrib/gperf/src/options.h
+++ b/contrib/gperf/src/options.h
@@ -209,9 +209,6 @@ public:
/* Sets the delimiters string, if not already set. */
void set_delimiters (const char *delimiters);
- const char * get_size_type() const;
- void set_size_type(const char*);
-
/* Returns key positions. */
const Positions& get_key_positions () const;
@@ -282,8 +279,6 @@ private:
/* Separates keywords from other attributes. */
const char * _delimiters;
- const char * _size_type;
-
/* Contains user-specified key choices. */
Positions _key_positions;
};
diff --git a/contrib/gperf/src/options.icc b/contrib/gperf/src/options.icc
index 8931e36..4188ddc 100644
--- a/contrib/gperf/src/options.icc
+++ b/contrib/gperf/src/options.icc
@@ -155,9 +155,3 @@ Options::get_key_positions () const
{
return _key_positions;
}
-
-INLINE const char *
-Options::get_size_type() const
-{
- return _size_type;
-}
diff --git a/contrib/gperf/src/output.cc b/contrib/gperf/src/output.cc
index 9cb3dd4..c5569eb 100644
--- a/contrib/gperf/src/output.cc
+++ b/contrib/gperf/src/output.cc
@@ -772,14 +772,14 @@ Output::output_hash_function () const
printf (option[KRC] ?
"(str, len)\n"
" register char *str;\n"
- " register %s len;\n" :
+ " register unsigned int len;\n" :
option[C] ?
"(str, len)\n"
" register const char *str;\n"
- " register %s len;\n" :
+ " register unsigned int len;\n" :
option[ANSIC] | option[CPLUSPLUS] ?
- "(register const char *str, register %s len)\n" :
- "%s", option.get_size_type());
+ "(register const char *str, register unsigned int len)\n" :
+ "");
/* Note that when the hash function is called, it has already been verified
that min_key_len <= len <= max_key_len. */
@@ -875,7 +875,7 @@ Output::output_hash_function () const
" switch (%s)\n"
" {\n"
" default:\n",
- option[NOLENGTH] ? "0" : "(int)len",
+ option[NOLENGTH] ? "0" : "len",
option[NOLENGTH] ? "len" : "hval");
while (key_pos != Positions::LASTCHAR && key_pos >= _max_key_len)
@@ -1900,14 +1900,14 @@ Output::output_lookup_function () const
printf (option[KRC] ?
"(str, len)\n"
" register char *str;\n"
- " register %s len;\n" :
+ " register unsigned int len;\n" :
option[C] ?
"(str, len)\n"
" register const char *str;\n"
- " register %s len;\n" :
+ " register unsigned int len;\n" :
option[ANSIC] | option[CPLUSPLUS] ?
- "(register const char *str, register %s len)\n" :
- "%s", option.get_size_type());
+ "(register const char *str, register unsigned int len)\n" :
+ "");
/* Output the function's body. */
printf ("{\n");
@@ -2074,14 +2074,13 @@ Output::output ()
printf ("class %s\n"
"{\n"
"private:\n"
- " static inline unsigned int %s (const char *str, %s len);\n"
+ " static inline unsigned int %s (const char *str, unsigned int len);\n"
"public:\n"
- " static %s%s%s (const char *str, %s len);\n"
+ " static %s%s%s (const char *str, unsigned int len);\n"
"};\n"
"\n",
- option.get_class_name (), option.get_hash_name (), option.get_size_type(),
- const_for_struct, _return_type, option.get_function_name (),
- option.get_size_type());
+ option.get_class_name (), option.get_hash_name (),
+ const_for_struct, _return_type, option.get_function_name ());
output_hash_function ();
OpenPOWER on IntegriCloud