Make compile_et output usable out-of-tree
authorBenjamin Kaduk <kaduk@mit.edu>
Tue, 27 Jan 2015 21:33:25 +0000 (16:33 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 29 Aug 2015 04:05:25 +0000 (00:05 -0400)
Prior to this commit, the output C files from compile_et would
emit #includes of <afsconfig.h> and <afs/param.h>.  These files
are not installed, and are only available in an OpenAFS build tree.
The output C files also emit #includes of <afs/error_table.h>, which
is an installed file, and is therefore expected to be available on
a system with OpenAFS installed.  Removing the first two headers will
allow OpenAFS's compile_et binary to be used to compile error tables
which are not part of OpenAFS, on systems where OpenAFS is installed.

The inclusion of afsconfig.h was added in commit
972a4072827fb2ec680354d5adebc2c5cca06939 to ensure that it was included
prior to afs/param.h; however, the inclusion of afs/param.h in
compile_et.c stems from the original IBM import and seems of minimal
value.  The only changes needed to build without param.h are to use
int instead of afs_int32 in a couple places (int is 32 bits on
all platforms currently supported) and to include <sys/types.h>
for size_t.

Change-Id: I1ee969eec92b139d265a7494e13ddfc69c05f238
Reviewed-on: http://gerrit.openafs.org/11708
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/comerr/com_err.h
src/comerr/compile_et.c
src/comerr/error_table.h
src/comerr/et_name.c

index 79f3a45..062ab1c 100644 (file)
@@ -19,7 +19,7 @@ extern void afs_com_err_va(const char *whoami, afs_int32 code, const char *fmt,
                       va_list args)
     AFS_ATTRIBUTE_FORMAT(__printf__, 3, 0);
 
-extern const char *afs_error_table_name(afs_int32);
+extern const char *afs_error_table_name(int);
 extern const char *afs_error_message(afs_int32);
 extern const char *afs_error_message_localize(afs_int32 code, char *str, size_t len);
 extern
index 184d7b4..87e000e 100644 (file)
@@ -89,8 +89,6 @@ static const char *const language_names[] = {
 };
 
 static const char *const c_src_prolog[] = {
-    "#include <afsconfig.h>\n",
-    "#include <afs/param.h>\n",
     "#include <afs/error_table.h>\n",
     "static const char * const text[] = {\n",
     0,
index 642cd95..a58ab47 100644 (file)
@@ -5,15 +5,14 @@
  * For copyright info, see mit-sipb-cr.h.
  */
 
-#include <afs/param.h>
-
+#include <sys/types.h>
 #include <errno.h>
 
 #ifndef _AFS_ET_H
 
 struct error_table {
     char const *const *msgs;
-    afs_int32 base;
+    int base;
     int n_msgs;
 };
 struct et_list {
@@ -25,7 +24,7 @@ struct et_list {
 #define        ERRCODE_RANGE   8       /* # of bits to shift table number */
 #define        BITS_PER_CHAR   6       /* # bits to shift per character in name */
 
-extern char const *afs_error_table_name(afs_int32 num);
+extern char const *afs_error_table_name(int num);
 extern void afs_add_to_error_table(struct et_list *new_table);
 extern const char *afs_com_right(struct et_list *list, long code);
 extern const char *afs_com_right_r(struct et_list *list, long code, char *str, size_t len);
index 8e87918..f6393cc 100644 (file)
@@ -21,7 +21,7 @@ static const char char_set[] =
 static char buf[6];
 
 const char *
-afs_error_table_name(afs_int32 num)
+afs_error_table_name(int num)
 {
     int ch;
     int i;