uint8_t os_flags_UNUSED;
} PACKED formatted;
} 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
} pipeline;
} FIX_ALIASING;
#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 { \
+ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
G.sed_cmd_tail = &G.sed_cmd_head; \
} while (0)
IDX_rbrace,
IDX_nul
};
- struct chk { char chk[sizeof(cmd_letters)-1 == IDX_nul ? 1 : -1]; };
+ unsigned idx;
+
+ BUILD_BUG_ON(sizeof(cmd_letters)-1 != IDX_nul);
- unsigned idx = strchrnul(cmd_letters, sed_cmd->cmd) - cmd_letters;
+ idx = strchrnul(cmd_letters, sed_cmd->cmd) - cmd_letters;
/* handle (s)ubstitution command */
if (idx == IDX_s) {
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
#define INIT_G() do { \
- struct G_sizecheck { \
- char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
- }; \
+ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
/* we have to zero it out because of NOEXEC */ \
memset(&G, 0, sizeof(G)); \
IF_FEATURE_FIND_MAXDEPTH(G.minmaxdepth[1] = INT_MAX;) \
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
#define INIT_G() do { \
- struct G_sizecheck { \
- char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
- }; \
+ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
#define max_matches (G.max_matches )
#if !ENABLE_EXTRA_COMPAT
#endif
} FIX_ALIASING;
#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_geom (G.get_geom )
#define do_flush (G.do_flush )
#define hwif_data (G.hwif_data )
#define hwif_ctrl (G.hwif_ctrl )
#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 */
#define TASKSET_PRINTF_MASK "%llx"
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;
+ BUILD_BUG_ON(CPU_SETSIZE < sizeof(int));
+
/* Take the least significant bits. Careful!
* Consider both CPU_SETSIZE=4 and CPU_SETSIZE=1024 cases
*/
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
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 (G.rlim_ofile )
#define serv_list (G.serv_list )
#define allsock (G.allsock )
#define line (G.line )
#define INIT_G() do { \
+ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
rlim_ofile_cur = OPEN_MAX; \
global_queuelen = 128; \
config_filename = "/etc/inetd.conf"; \
uint32_t flags;
char data[124];
} 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)
if (argc != 4)
} FIX_ALIASING;
#define G (*(struct globals*)&bb_common_bufsiz1)
#define INIT_G() do { \
- struct G_sizecheck { \
- char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
- }; \
+ BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \
} while (0)
}; //FIX_ALIASING; - large code growth
enum { LINE_BUF_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line_buf) };
#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 ntop (G.ntop )
#define sort_field (G.sort_field )
#define num_cpus (G.num_cpus )
#define total_pcpu (G.total_pcpu )
#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 {
OPT_d = (1 << 0),