*: more BUILD_BUG_ON conversions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
4d0c1ea478
commit
7b85ec30b5
@ -1118,9 +1118,8 @@ static int check_header_gzip(STATE_PARAM transformer_state_t *xstate)
|
|||||||
uint8_t os_flags_UNUSED;
|
uint8_t os_flags_UNUSED;
|
||||||
} PACKED formatted;
|
} PACKED formatted;
|
||||||
} header;
|
} header;
|
||||||
struct BUG_header {
|
|
||||||
char BUG_header[sizeof(header) == 8 ? 1 : -1];
|
BUILD_BUG_ON(sizeof(header) != 8);
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rewind bytebuffer. We use the beginning because the header has 8
|
* Rewind bytebuffer. We use the beginning because the header has 8
|
||||||
|
@ -162,10 +162,8 @@ struct globals {
|
|||||||
} pipeline;
|
} pipeline;
|
||||||
} FIX_ALIASING;
|
} FIX_ALIASING;
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
struct BUG_G_too_big {
|
|
||||||
char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
|
|
||||||
};
|
|
||||||
#define INIT_G() do { \
|
#define INIT_G() do { \
|
||||||
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
G.sed_cmd_tail = &G.sed_cmd_head; \
|
G.sed_cmd_tail = &G.sed_cmd_head; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -501,9 +499,11 @@ static const char *parse_cmd_args(sed_cmd_t *sed_cmd, const char *cmdstr)
|
|||||||
IDX_rbrace,
|
IDX_rbrace,
|
||||||
IDX_nul
|
IDX_nul
|
||||||
};
|
};
|
||||||
struct chk { char chk[sizeof(cmd_letters)-1 == IDX_nul ? 1 : -1]; };
|
unsigned idx;
|
||||||
|
|
||||||
unsigned idx = strchrnul(cmd_letters, sed_cmd->cmd) - cmd_letters;
|
BUILD_BUG_ON(sizeof(cmd_letters)-1 != IDX_nul);
|
||||||
|
|
||||||
|
idx = strchrnul(cmd_letters, sed_cmd->cmd) - cmd_letters;
|
||||||
|
|
||||||
/* handle (s)ubstitution command */
|
/* handle (s)ubstitution command */
|
||||||
if (idx == IDX_s) {
|
if (idx == IDX_s) {
|
||||||
|
@ -423,9 +423,7 @@ struct globals {
|
|||||||
} FIX_ALIASING;
|
} FIX_ALIASING;
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
#define INIT_G() do { \
|
#define INIT_G() do { \
|
||||||
struct G_sizecheck { \
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
|
|
||||||
}; \
|
|
||||||
/* we have to zero it out because of NOEXEC */ \
|
/* we have to zero it out because of NOEXEC */ \
|
||||||
memset(&G, 0, sizeof(G)); \
|
memset(&G, 0, sizeof(G)); \
|
||||||
IF_FEATURE_FIND_MAXDEPTH(G.minmaxdepth[1] = INT_MAX;) \
|
IF_FEATURE_FIND_MAXDEPTH(G.minmaxdepth[1] = INT_MAX;) \
|
||||||
|
@ -203,9 +203,7 @@ struct globals {
|
|||||||
} FIX_ALIASING;
|
} FIX_ALIASING;
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
#define INIT_G() do { \
|
#define INIT_G() do { \
|
||||||
struct G_sizecheck { \
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
|
|
||||||
}; \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
#define max_matches (G.max_matches )
|
#define max_matches (G.max_matches )
|
||||||
#if !ENABLE_EXTRA_COMPAT
|
#if !ENABLE_EXTRA_COMPAT
|
||||||
|
@ -368,9 +368,6 @@ struct globals {
|
|||||||
#endif
|
#endif
|
||||||
} FIX_ALIASING;
|
} FIX_ALIASING;
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
struct BUG_G_too_big {
|
|
||||||
char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
|
|
||||||
};
|
|
||||||
#define get_identity (G.get_identity )
|
#define get_identity (G.get_identity )
|
||||||
#define get_geom (G.get_geom )
|
#define get_geom (G.get_geom )
|
||||||
#define do_flush (G.do_flush )
|
#define do_flush (G.do_flush )
|
||||||
@ -433,7 +430,9 @@ struct BUG_G_too_big {
|
|||||||
#define hwif_data (G.hwif_data )
|
#define hwif_data (G.hwif_data )
|
||||||
#define hwif_ctrl (G.hwif_ctrl )
|
#define hwif_ctrl (G.hwif_ctrl )
|
||||||
#define hwif_irq (G.hwif_irq )
|
#define hwif_irq (G.hwif_irq )
|
||||||
#define INIT_G() do { } while (0)
|
#define INIT_G() do { \
|
||||||
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
/* Busybox messages and functions */
|
/* Busybox messages and functions */
|
||||||
|
@ -75,12 +75,10 @@ static char *from_cpuset(cpu_set_t *mask)
|
|||||||
#define TASKSET_PRINTF_MASK "%llx"
|
#define TASKSET_PRINTF_MASK "%llx"
|
||||||
static unsigned long long from_cpuset(cpu_set_t *mask)
|
static unsigned long long from_cpuset(cpu_set_t *mask)
|
||||||
{
|
{
|
||||||
struct BUG_CPU_SETSIZE_is_too_small {
|
|
||||||
char BUG_CPU_SETSIZE_is_too_small[
|
|
||||||
CPU_SETSIZE < sizeof(int) ? -1 : 1];
|
|
||||||
};
|
|
||||||
char *p = (void*)mask;
|
char *p = (void*)mask;
|
||||||
|
|
||||||
|
BUILD_BUG_ON(CPU_SETSIZE < sizeof(int));
|
||||||
|
|
||||||
/* Take the least significant bits. Careful!
|
/* Take the least significant bits. Careful!
|
||||||
* Consider both CPU_SETSIZE=4 and CPU_SETSIZE=1024 cases
|
* Consider both CPU_SETSIZE=4 and CPU_SETSIZE=1024 cases
|
||||||
*/
|
*/
|
||||||
|
@ -329,9 +329,6 @@ struct globals {
|
|||||||
} FIX_ALIASING;
|
} FIX_ALIASING;
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
enum { LINE_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line) };
|
enum { LINE_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line) };
|
||||||
struct BUG_G_too_big {
|
|
||||||
char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
|
|
||||||
};
|
|
||||||
#define rlim_ofile_cur (G.rlim_ofile_cur )
|
#define rlim_ofile_cur (G.rlim_ofile_cur )
|
||||||
#define rlim_ofile (G.rlim_ofile )
|
#define rlim_ofile (G.rlim_ofile )
|
||||||
#define serv_list (G.serv_list )
|
#define serv_list (G.serv_list )
|
||||||
@ -352,6 +349,7 @@ struct BUG_G_too_big {
|
|||||||
#define allsock (G.allsock )
|
#define allsock (G.allsock )
|
||||||
#define line (G.line )
|
#define line (G.line )
|
||||||
#define INIT_G() do { \
|
#define INIT_G() do { \
|
||||||
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
rlim_ofile_cur = OPEN_MAX; \
|
rlim_ofile_cur = OPEN_MAX; \
|
||||||
global_queuelen = 128; \
|
global_queuelen = 128; \
|
||||||
config_filename = "/etc/inetd.conf"; \
|
config_filename = "/etc/inetd.conf"; \
|
||||||
|
@ -57,9 +57,8 @@ int nbdclient_main(int argc, char **argv)
|
|||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
char data[124];
|
char data[124];
|
||||||
} nbd_header;
|
} nbd_header;
|
||||||
struct bug_check {
|
|
||||||
char c[offsetof(struct nbd_header_t, data) == 8+8+8+4 ? 1 : -1];
|
BUILD_BUG_ON(offsetof(struct nbd_header_t, data) != 8+8+8+4);
|
||||||
};
|
|
||||||
|
|
||||||
// Parse command line stuff (just a stub now)
|
// Parse command line stuff (just a stub now)
|
||||||
if (argc != 4)
|
if (argc != 4)
|
||||||
|
@ -110,9 +110,7 @@ struct globals {
|
|||||||
} FIX_ALIASING;
|
} FIX_ALIASING;
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
#define INIT_G() do { \
|
#define INIT_G() do { \
|
||||||
struct G_sizecheck { \
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
|
|
||||||
}; \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,10 +184,6 @@ struct globals {
|
|||||||
}; //FIX_ALIASING; - large code growth
|
}; //FIX_ALIASING; - large code growth
|
||||||
enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
|
enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
|
||||||
#define G (*(struct globals*)&bb_common_bufsiz1)
|
#define G (*(struct globals*)&bb_common_bufsiz1)
|
||||||
struct BUG_bad_size {
|
|
||||||
char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1];
|
|
||||||
char BUG_line_buf_too_small[LINE_BUF_SIZE > 80 ? 1 : -1];
|
|
||||||
};
|
|
||||||
#define top (G.top )
|
#define top (G.top )
|
||||||
#define ntop (G.ntop )
|
#define ntop (G.ntop )
|
||||||
#define sort_field (G.sort_field )
|
#define sort_field (G.sort_field )
|
||||||
@ -204,7 +200,10 @@ struct BUG_bad_size {
|
|||||||
#define num_cpus (G.num_cpus )
|
#define num_cpus (G.num_cpus )
|
||||||
#define total_pcpu (G.total_pcpu )
|
#define total_pcpu (G.total_pcpu )
|
||||||
#define line_buf (G.line_buf )
|
#define line_buf (G.line_buf )
|
||||||
#define INIT_G() do { } while (0)
|
#define INIT_G() do { \
|
||||||
|
BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
|
||||||
|
BUILD_BUG_ON(LINE_BUF_SIZE <= 80); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
OPT_d = (1 << 0),
|
OPT_d = (1 << 0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user