Changeset 4339f09 in mainline


Ignore:
Timestamp:
2013-06-28T07:46:31Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e52b4b5
Parents:
3de67b4c (diff), dba3e2c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Mostly C style (obey clang suggestions)

Merge from lp:~vojtech-horky/helenos/misc.

Most changes driven by warnings/errors from clang, such as type
redefinitions (typedef struct …) or possibly uninitizalied
variables. Clang still emits some warnings but a lot less than
before :-). As a result, kernel can be built with clang/-Werror.

Also updated mkext2.py to work with Python 3 again.

Files:
2 added
26 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    r3de67b4c r4339f09  
    105105CLANG_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
    106106        -ffreestanding -fno-builtin -nostdlib -nostdinc \
    107         -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
     107        -Wall -Werror -Wextra -Wno-unused-parameter -Wmissing-prototypes \
    108108        -Werror-implicit-function-declaration -Wwrite-strings \
    109109        -integrated-as \
  • kernel/generic/include/lib/memfnc.h

    r3de67b4c r4339f09  
    3737
    3838#include <typedefs.h>
     39#include <cc.h>
    3940
    4041extern void *memset(void *, int, size_t)
    41     __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     42    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4243extern void *memcpy(void *, const void *, size_t)
    43     __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     44    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4445
    4546#endif
  • kernel/test/print/print4.c

    r3de67b4c r4339f09  
    3636        uint8_t group;
    3737        for (group = 1; group < 4; group++) {
    38                 TPRINTF("%#" PRIx8 ": ", group << 5);
     38                TPRINTF("%#x: ", group << 5);
    3939               
    4040                uint8_t index;
     
    5252       
    5353        for (group = 4; group < 8; group++) {
    54                 TPRINTF("%#" PRIx8 ": ", group << 5);
     54                TPRINTF("%#x: ", group << 5);
    5555               
    5656                uint8_t index;
  • tools/mkext2.py

    r3de67b4c r4339f09  
    3939import uuid
    4040from imgutil import *
     41
     42if sys.version >= '3':
     43        xrange = range
    4144
    4245GDE_SIZE = 32
     
    530533                data.flags = 0
    531534                blockconv = lambda x: 0 if x == None else x
    532                 data.direct_blocks = map(blockconv, self.direct)
    533                 data.indirect_blocks = map(blockconv, self.indirect)
     535                data.direct_blocks = list(map(blockconv, self.direct))
     536                data.indirect_blocks = list(map(blockconv, self.indirect))
    534537                data.version = 0
    535538                data.file_acl = 0
     
    567570                head.inode_type = self.type
    568571                inode.write(head.pack())
    569                 inode.write(self.name+'\0')
     572                inode.write(self.name+'\0'.encode())
    570573                inode.align_pos(4)
    571574
  • uspace/app/bdsh/cmds/modules/help/help.c

    r3de67b4c r4339f09  
    9898        builtin_t *cmd;
    9999        module_t *mod;
    100         unsigned int i;
    101100
    102101        printf("\n  Bdsh built-in commands:\n");
     
    104103
    105104        /* First, show a list of built in commands that are available in this mode */
    106         for (cmd = builtins; cmd->name != NULL; cmd++, i++) {
     105        for (cmd = builtins; cmd->name != NULL; cmd++) {
    107106                        if (is_builtin_alias(cmd->name))
    108107                                printf("   %-16s\tAlias for `%s'\n", cmd->name,
     
    112111        }
    113112
    114         i = 0;
    115 
    116113        /* Now, show a list of module commands that are available in this mode */
    117         for (mod = modules; mod->name != NULL; mod++, i++) {
     114        for (mod = modules; mod->name != NULL; mod++) {
    118115                        if (is_module_alias(mod->name))
    119116                                printf("   %-16s\tAlias for `%s'\n", mod->name,
  • uspace/app/bdsh/cmds/modules/pwd/pwd.c

    r3de67b4c r4339f09  
    5555        }
    5656
    57         memset(buff, 0, sizeof(buff));
     57        memset(buff, 0, PATH_MAX);
    5858        getcwd(buff, PATH_MAX);
    5959
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    r3de67b4c r4339f09  
    9999        if (NULL == (rm->nwd = (char *) malloc(PATH_MAX)))
    100100                return 0;
    101         memset(rm->nwd, 0, sizeof(rm->nwd));
     101        memset(rm->nwd, 0, PATH_MAX);
    102102
    103103        if (NULL == (rm->owd = (char *) malloc(PATH_MAX)))
    104104                return 0;
    105         memset(rm->owd, 0, sizeof(rm->owd));
     105        memset(rm->owd, 0, PATH_MAX);
    106106
    107107        if (NULL == (rm->cwd = (char *) malloc(PATH_MAX)))
    108108                return 0;
    109         memset(rm->cwd, 0, sizeof(rm->cwd));
     109        memset(rm->cwd, 0, PATH_MAX);
    110110
    111111        chdir(".");
     
    298298                        break;
    299299                }
    300                 memset(buff, 0, sizeof(buff));
     300                memset(buff, 0, len);
    301301                snprintf(buff, len, "%s", argv[i]);
    302302
  • uspace/app/bdsh/exec.c

    r3de67b4c r4339f09  
    8383        /* We now have n places to look for the command */
    8484        for (i = 0; search_dir[i] != NULL; i++) {
    85                 memset(found, 0, sizeof(found));
     85                memset(found, 0, PATH_MAX);
    8686                snprintf(found, PATH_MAX, "%s/%s", search_dir[i], cmd);
    8787                if (-1 != try_access(found)) {
  • uspace/app/edit/search_impl.h

    r3de67b4c r4339f09  
    4040
    4141/** Search state */
    42 typedef struct search {
     42struct search {
    4343        /* Note: This structure is opaque for the user. */
    4444
     
    4949        void *client_data;
    5050        search_ops_t ops;
    51 } search_t;
     51};
    5252
    5353#endif
  • uspace/app/edit/sheet_impl.h

    r3de67b4c r4339f09  
    4040
    4141/** Sheet */
    42 typedef struct sheet {
     42struct sheet {
    4343        /* Note: This structure is opaque for the user. */
    4444
     
    4848
    4949        list_t tags;
    50 } sheet_t;
     50};
    5151
    5252#endif
  • uspace/drv/bus/usb/vhc/hub/virthubops.c

    r3de67b4c r4339f09  
    299299    size_t *act_size)
    300300{
    301         int rc;
     301        int rc = ENOTSUP;
    302302        size_t port = request->index - 1;
    303303        usb_hub_class_feature_t feature = request->value;
  • uspace/drv/char/ps2mouse/ps2mouse.c

    r3de67b4c r4339f09  
    7070#define PS2_BUTTON_MASK(button) (1 << button)
    7171
    72 #define MOUSE_READ_BYTE_TEST(sess, value) \
     72#define MOUSE_READ_BYTE_TEST(sess, value_) \
    7373do { \
     74        uint8_t value = (value_); \
    7475        uint8_t data = 0; \
    7576        const ssize_t size = chardev_read(sess, &data, 1); \
     
    7879                return size < 0 ? size : EIO; \
    7980        } \
    80         if (data != (value)) { \
     81        if (data != value) { \
    8182                ddf_msg(LVL_DEBUG, "Failed testing byte: got %hhx vs. %hhx)", \
    82                     data, (value)); \
     83                    data, value); \
    8384                return EIO; \
    8485        } \
    8586} while (0)
    8687
    87 #define MOUSE_WRITE_BYTE(sess, value) \
     88#define MOUSE_WRITE_BYTE(sess, value_) \
    8889do { \
     90        uint8_t value = (value_); \
    8991        uint8_t data = (value); \
    9092        const ssize_t size = chardev_write(sess, &data, 1); \
  • uspace/drv/nic/rtl8139/driver.c

    r3de67b4c r4339f09  
    620620                if (size == 0 || size > RTL8139_FRAME_MAX_LENGTH) {
    621621                        ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4" PRIu16 ", "
    622                             "header 0x%4" PRIx16 ". Offset: %d)", size, frame_header,
     622                            "header 0x%4" PRIx32 ". Offset: %" PRIu16 ")", size, frame_header,
    623623                            rx_offset);
    624624                        goto rx_err;
  • uspace/lib/c/generic/devman.c

    r3de67b4c r4339f09  
    413413        sysarg_t dretval;
    414414       
    415         exch = devman_exchange_begin_blocking(LOC_PORT_CONSUMER);
     415        exch = devman_exchange_begin_blocking(DEVMAN_CLIENT);
    416416       
    417417        ipc_call_t answer;
  • uspace/lib/c/include/bd_srv.h

    r3de67b4c r4339f09  
    5757} bd_srv_t;
    5858
    59 typedef struct bd_ops {
     59struct bd_ops {
    6060        int (*open)(bd_srvs_t *, bd_srv_t *);
    6161        int (*close)(bd_srv_t *);
     
    6565        int (*get_block_size)(bd_srv_t *, size_t *);
    6666        int (*get_num_blocks)(bd_srv_t *, aoff64_t *);
    67 } bd_ops_t;
     67};
    6868
    6969extern void bd_srvs_init(bd_srvs_t *);
  • uspace/lib/c/include/io/con_srv.h

    r3de67b4c r4339f09  
    6666} con_srv_t;
    6767
    68 typedef struct con_ops {
     68struct con_ops {
    6969        int (*open)(con_srvs_t *, con_srv_t *);
    7070        int (*close)(con_srv_t *);
     
    8383        void (*set_cursor_visibility)(con_srv_t *, bool);
    8484        int (*get_event)(con_srv_t *, cons_event_t *);
    85 } con_ops_t;
     85};
    8686
    8787extern void con_srvs_init(con_srvs_t *);
  • uspace/lib/c/include/mem.h

    r3de67b4c r4339f09  
    3737
    3838#include <sys/types.h>
     39#include <cc.h>
    3940
    4041extern void *memset(void *, int, size_t)
    41     __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     42    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4243extern void *memcpy(void *, const void *, size_t)
    43     __attribute__ ((optimize("-fno-tree-loop-distribute-patterns")));
     44    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns");
    4445extern void *memmove(void *, const void *, size_t);
    4546extern int memcmp(const void *, const void *, size_t);
  • uspace/lib/draw/drawctx.h

    r3de67b4c r4339f09  
    4747#include "font.h"
    4848
    49 typedef struct drawctx {
     49struct drawctx {
    5050        link_t link;
    5151        list_t list;
     
    6262        sysarg_t clip_width;
    6363        sysarg_t clip_height;
    64 } drawctx_t;
     64};
    6565
    6666extern void drawctx_init(drawctx_t *, surface_t *);
  • uspace/lib/gui/connection.h

    r3de67b4c r4339f09  
    3838
    3939#include <sys/types.h>
    40 
    41 struct widget;
    42 typedef struct widget widget_t;
     40#include "widget.h"
    4341
    4442typedef sysarg_t signal_t;
  • uspace/lib/gui/widget.h

    r3de67b4c r4339f09  
    5151 * any derived widget structure.
    5252 */
    53 typedef struct widget {
     53struct widget {
    5454        link_t link;
    5555        widget_t *parent; /**< Parent widget of this widget. NULL for root widget. */
     
    116116         * also acquire or release mouse grab. */
    117117        void (*handle_position_event)(widget_t *, pos_event_t);
    118 } widget_t;
     118};
    119119
    120120/*
  • uspace/lib/gui/window.h

    r3de67b4c r4339f09  
    4747#include "widget.h"
    4848
    49 typedef struct window {
     49struct window {
    5050        bool is_main; /**< True for the main window of the application. */
    5151        bool is_decorated; /**< True if the window decorations should be rendered. */
     
    6060        fibril_mutex_t guard; /**< Mutex guarding window surface. */
    6161        surface_t *surface; /**< Window surface shared with compositor. */
    62 } window_t;
     62};
    6363
    6464/**
  • uspace/lib/usbhid/src/hidiface.c

    r3de67b4c r4339f09  
    9090                return EINVAL;
    9191       
    92         if ((buf == NULL))
     92        if (buf == NULL)
    9393                return ENOMEM;
    9494       
     
    184184                return EINVAL;
    185185       
    186         if ((buf == NULL))
     186        if (buf == NULL)
    187187                return ENOMEM;
    188188       
  • uspace/srv/hid/input/port/adb.c

    r3de67b4c r4339f09  
    118118                ipc_callid_t callid = async_get_call(&call);
    119119
    120                 int retval;
     120                int retval = EOK;
    121121               
    122122                if (!IPC_GET_IMETHOD(call)) {
  • uspace/srv/hid/input/port/adb_mouse.c

    r3de67b4c r4339f09  
    5454                ipc_callid_t callid = async_get_call(&call);
    5555               
    56                 int retval;
     56                int retval = EOK;
    5757               
    5858                if (!IPC_GET_IMETHOD(call)) {
  • uspace/srv/hid/input/port/chardev.c

    r3de67b4c r4339f09  
    148148                }
    149149
    150                 int retval;
     150                int retval = EOK;
    151151
    152152                switch (IPC_GET_IMETHOD(call)) {
  • uspace/srv/hid/isdv4_tablet/isdv4.h

    r3de67b4c r4339f09  
    7676} isdv4_source_type_t;
    7777
    78 typedef struct isdv4_event {
     78struct isdv4_event {
    7979        isdv4_event_type_t type;
    8080        isdv4_source_type_t source;
     
    8383        unsigned int pressure;
    8484        unsigned int button;
    85 } isdv4_event_t;
     85};
    8686
    8787extern int isdv4_init(isdv4_state_t *, async_sess_t *, isdv4_event_fn);
Note: See TracChangeset for help on using the changeset viewer.