Changeset 1cf26ab in mainline


Ignore:
Timestamp:
2016-05-14T06:44:37Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
362654a
Parents:
1023758
Message:

Use static assert instead of regular ones

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/main/kinit.c

    r1023758 r1cf26ab  
    240240                        name = "<unknown>";
    241241               
    242                 ASSERT(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN);
     242                STATIC_ASSERT(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN);
    243243                str_cpy(namebuf, TASK_NAME_BUFLEN, INIT_PREFIX);
    244244                str_cpy(namebuf + INIT_PREFIX_LEN,
  • uspace/app/sbi/src/bigint.c

    r1023758 r1cf26ab  
    379379        printf("Convert bigint to string.\n");
    380380#endif
    381         assert(BIGINT_BASE >= 10);
     381        static_assert(BIGINT_BASE >= 10);
    382382
    383383        /* Compute number of characters. */
  • uspace/drv/bus/usb/ohci/hw_struct/hcca.h

    r1023758 r1cf26ab  
    6565static inline hcca_t * hcca_get(void)
    6666{
    67         assert(sizeof(hcca_t) == 256);
     67        static_assert(sizeof(hcca_t) == 256);
    6868        hcca_t *hcca = memalign(256, sizeof(hcca_t));
    6969        if (hcca)
  • uspace/drv/bus/usb/uhci/uhci_batch.c

    r1023758 r1cf26ab  
    8787uhci_transfer_batch_t * uhci_transfer_batch_get(usb_transfer_batch_t *usb_batch)
    8888{
    89         assert((sizeof(td_t) % 16) == 0);
     89        static_assert((sizeof(td_t) % 16) == 0);
    9090#define CHECK_NULL_DISPOSE_RETURN(ptr, message...) \
    9191        if (ptr == NULL) { \
  • uspace/lib/c/generic/double_to_str.c

    r1023758 r1cf26ab  
    505505{
    506506        /* The whole computation assumes 64bit significand. */
    507         assert(sizeof(ieee_val.pos_val.significand) == sizeof(uint64_t));
     507        static_assert(sizeof(ieee_val.pos_val.significand) == sizeof(uint64_t));
    508508
    509509        if (ieee_val.is_special) {
     
    753753{
    754754        /* The whole computation assumes 64bit significand. */
    755         assert(sizeof(ieee_val.pos_val.significand) == sizeof(uint64_t));
     755        static_assert(sizeof(ieee_val.pos_val.significand) == sizeof(uint64_t));
    756756
    757757        if (ieee_val.is_special) {
  • uspace/lib/c/generic/ieee_double.c

    r1023758 r1cf26ab  
    4545        const int exponent_bias = 1075;
    4646
    47         assert(sizeof(val) == sizeof(uint64_t));
     47        static_assert(sizeof(val) == sizeof(uint64_t));
    4848
    4949        union {
  • uspace/lib/c/include/assert.h

    r1023758 r1cf26ab  
    3737#define LIBC_ASSERT_H_
    3838
     39#define static_assert(expr)     _Static_assert(expr, "")
     40
    3941/** Debugging assert macro
    4042 *
  • uspace/lib/posix/source/fnmatch.c

    r1023758 r1cf26ab  
    640640        #define nomatch(s1, s2, flags) assert(posix_fnmatch(s1, s2, flags) == FNM_NOMATCH)
    641641
    642         assert(FNM_PATHNAME == FNM_FILE_NAME);
     642        static_assert(FNM_PATHNAME == FNM_FILE_NAME);
    643643        match("", "", 0);
    644644        match("*", "hello", 0);
  • uspace/lib/usbdev/include/usb/dev/request.h

    r1023758 r1cf26ab  
    109109} __attribute__ ((packed)) usb_device_request_setup_packet_t;
    110110
    111 int assert[(sizeof(usb_device_request_setup_packet_t) == 8) ? 1: -1];
    112 
    113111int usb_control_request_set(usb_pipe_t *,
    114112    usb_request_type_t, usb_request_recipient_t, uint8_t,
  • uspace/lib/usbdev/src/pipesinit.c

    r1023758 r1cf26ab  
    340340{
    341341        assert(pipe);
    342         assert(DEV_DESCR_MAX_PACKET_SIZE_OFFSET < CTRL_PIPE_MIN_PACKET_SIZE);
     342        static_assert(DEV_DESCR_MAX_PACKET_SIZE_OFFSET < CTRL_PIPE_MIN_PACKET_SIZE);
    343343
    344344        if ((pipe->direction != USB_DIRECTION_BOTH) ||
  • uspace/lib/usbdev/src/request.c

    r1023758 r1cf26ab  
    3939
    4040#define MAX_DATA_LENGTH ((size_t)(0xFFFF))
     41
     42static_assert(sizeof(usb_device_request_setup_packet_t) == 8);
    4143
    4244/** Generic wrapper for SET requests using standard control request format.
  • uspace/srv/net/inetsrv/pdu.c

    r1023758 r1cf26ab  
    224224                return EINVAL;
    225225       
    226         assert(sizeof(ip6_header_t) % 8 == 0);
     226        static_assert(sizeof(ip6_header_t) % 8 == 0);
    227227        assert(hdr_size % 8 == 0);
    228228        assert(offs % FRAG_OFFS_UNIT == 0);
Note: See TracChangeset for help on using the changeset viewer.