Commit c92a441a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] u_int32_t causes cross-compile problems

From: Pratik Solanki <pratik.solanki@timesys.com>

I came across this C standards issue while cross-compiling the Linux kernel
with gcc on Solaris.  The file gen_crc32table.c uses the non-standard type
u_int32_t.  It's possible that the host machine's sys/types.h does not
define u_int32_t.  The attached patch replaces u_int32_t with the POSIX
standard uint32_t and includes POSIX inttypes.h instead of sys/types.h.
parent ccd3fed5
#include <stdio.h> #include <stdio.h>
#include "crc32defs.h" #include "crc32defs.h"
#include <sys/types.h> #include <inttypes.h>
#define ENTRIES_PER_LINE 4 #define ENTRIES_PER_LINE 4
#define LE_TABLE_SIZE (1 << CRC_LE_BITS) #define LE_TABLE_SIZE (1 << CRC_LE_BITS)
#define BE_TABLE_SIZE (1 << CRC_BE_BITS) #define BE_TABLE_SIZE (1 << CRC_BE_BITS)
static u_int32_t crc32table_le[LE_TABLE_SIZE]; static uint32_t crc32table_le[LE_TABLE_SIZE];
static u_int32_t crc32table_be[BE_TABLE_SIZE]; static uint32_t crc32table_be[BE_TABLE_SIZE];
/** /**
* crc32init_le() - allocate and initialize LE table data * crc32init_le() - allocate and initialize LE table data
...@@ -20,7 +20,7 @@ static u_int32_t crc32table_be[BE_TABLE_SIZE]; ...@@ -20,7 +20,7 @@ static u_int32_t crc32table_be[BE_TABLE_SIZE];
static void crc32init_le(void) static void crc32init_le(void)
{ {
unsigned i, j; unsigned i, j;
u_int32_t crc = 1; uint32_t crc = 1;
crc32table_le[0] = 0; crc32table_le[0] = 0;
...@@ -37,7 +37,7 @@ static void crc32init_le(void) ...@@ -37,7 +37,7 @@ static void crc32init_le(void)
static void crc32init_be(void) static void crc32init_be(void)
{ {
unsigned i, j; unsigned i, j;
u_int32_t crc = 0x80000000; uint32_t crc = 0x80000000;
crc32table_be[0] = 0; crc32table_be[0] = 0;
...@@ -48,7 +48,7 @@ static void crc32init_be(void) ...@@ -48,7 +48,7 @@ static void crc32init_be(void)
} }
} }
static void output_table(u_int32_t table[], int len, char *trans) static void output_table(uint32_t table[], int len, char *trans)
{ {
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment