ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] lclint ran on ratpoison sources


From: Gergely Nagy
Subject: [RP] lclint ran on ratpoison sources
Date: Sun, 19 Aug 2001 00:38:36 +0200
User-agent: Mutt/1.3.20i

Here are the results of lclint -warnposix *.c in src/. Probably I'm
not using lclint the right way, and some of the problems mentioned
below are false warnings, we'll see. I didn't look at any of them,
save a few. I'll keep the list posted when I fix something.

LCLint 2.4b --- 18 Apr 98

actions.c: (in function find_keybinding)
actions.c:40:7: Operands of == have incompatible types (unsigned int, int):
                   key_actions[i].state == state
  To ignore signs in type comparisons use +ignoresigns


This one's easy. Just case state to unsigned int. Should work, imho.
  
actions.c:41:9: Immediate address &key_actions[] returned as implicitly only:
                   &key_actions[i]
  An immediate address (result of & operator) is transferred inconsistently.
  (-immediatetrans will suppress message)
actions.c:43:10: Null storage returned as non-null: NULL
  Function returns a possibly null pointer, but is not declared using
  /address@hidden@*/ annotation of result.  If function may return NULL, add 
/address@hidden@*/
  annotation to the return value declaration. (-nullret will suppress message)
actions.c: (in function add_keybinding)
actions.c:58:3: Assignment of int to unsigned int:
                   key_actions[key_actions_last].state = state
actions.c:59:40: Unrecognized identifier: strdup
  Identifier used in code has not been declared. (-unrecog will suppress
  message)
actions.c: (in function replace_keybinding)

This seems bogus to me.

actions.c:72:11: Possibly null storage key_action->data passed as non-null
                    param: strcpy (key_action->data, ...)
  A possibly null pointer is passed as a parameter corresponding to a formal
  parameter with no /address@hidden@*/ annotation.  If NULL may be used for this
  parameter, add a /address@hidden@*/ annotation to the function parameter 
declaration.
  (-nullpass will suppress message)
   actions.c:70:24: Storage key_action->data may become null
actions.c:73:2: Function returns with possibly null storage derivable from
                   parameter key_action->data
  A possibly null pointer is reachable from a parameter or global variable that
  is not declared using a /address@hidden@*/ annotation. (-nullstate will 
suppress
  message)
   actions.c:70:24: Storage key_action->data may become null
actions.c: (in function initialize_default_keybindings)
actions.c:82:3: Implicitly only storage prefix_key.sym not released before
                   assignment: prefix_key.sym = 0x074
  A memory leak has been detected. Newly-allocated or only-qualified storage is
  not released before the last reference to it is lost. (-mustfree will
  suppress message)
actions.c:83:3: Assignment of int to unsigned int: prefix_key.state = (1 << 2)
actions.c:85:35: Function add_keybinding expects arg 2 to be int gets unsigned
                    int: prefix_key.state
actions.c:196:6: Global user_commands[48].name initialized to null value:
                    user_commands[48].name = 0
  A reference with no null annotation is assigned or initialized to NULL.  Use
  /address@hidden@*/ to declare the reference as a possibly null pointer. 
(-nullassign
  will suppress message)
actions.c:196:11: Global user_commands[48].func initialized to null value:
                     user_commands[48].func = 0
actions.c: (in function string_to_keysym)
actions.c:207:8: Operand of ! is non-boolean (int): !retval
  The operand of a boolean operator is not a boolean. Use +ptrnegate to allow !
  to be used on pointers. (-boolops will suppress message)
actions.c:208:5: Clauses exit with keysym referencing fresh storage in true
                    branch, local storage in continuation
  The state of a variable is different depending on which branch is taken. This
  means no annotation can sensibly be applied to the storage. (-branchstate
  will suppress message)
   actions.c:208:5: Fresh storage keysym allocated
actions.c: (in function parse_keydesc)
actions.c:224:3: Implicitly only storage p->sym not released before assignment:
                    p->sym = 0
actions.c:229:7: Unqualified storage string_to_keysym(keydesc) assigned to
                    implicitly only: p->sym = string_to_keysym(keydesc)
  Unqualified storage is transferred in an inconsistent way. (-unqualifiedtrans
  will suppress message)
actions.c:250:8: Unqualified storage string_to_keysym(token) assigned to
                    implicitly only: p->sym = string_to_keysym(token)
actions.c:257:13: Operand of ! is non-boolean (int): !strcmp(token, "C")
actions.c:261:18: Operand of ! is non-boolean (int): !strcmp(token, "M")
actions.c:261:41: Right operand of && is non-boolean (unsigned int):
                     !strcmp(token, "M") && rp_modifier_info.meta_mod_mask
actions.c:265:18: Operand of ! is non-boolean (int): !strcmp(token, "A")
actions.c:265:41: Right operand of && is non-boolean (unsigned int):
                     !strcmp(token, "A") && rp_modifier_info.alt_mod_mask
actions.c:269:18: Operand of ! is non-boolean (int): !strcmp(token, "S")
actions.c:269:41: Right operand of && is non-boolean (unsigned int):
                     !strcmp(token, "S") && rp_modifier_info.super_mod_mask
actions.c:273:18: Operand of ! is non-boolean (int): !strcmp(token, "H")
actions.c:273:41: Right operand of && is non-boolean (unsigned int):
                     !strcmp(token, "H") && rp_modifier_info.hyper_mod_mask
actions.c: (in function cmd_bind)
actions.c:306:3: Return value (type int) ignored: sscanf(data, "%s...
  Result returned by function call is not used. If this is intended, can cast
  result to (void) to eliminate message. (-retvalint will suppress message)
actions.c:313:20: Operand of ! is non-boolean (char): !*cmd
actions.c:327:53: Function find_keybinding expects arg 2 to be int gets
                     unsigned int: key->state
actions.c:330:29: Function add_keybinding expects arg 2 to be int gets unsigned
                     int: key->state
actions.c:331:7: Fresh storage key_action not released before scope exit
   actions.c:327:13: Fresh storage key_action allocated
actions.c:334:3: Fresh storage key not released before scope exit
   actions.c:317:49: Fresh storage key allocated
actions.c: (in function cmd_unimplemented)
actions.c:341:26: Parameter data not used
  A function parameter is not used in the body of the function. If the argument
  is needed for type compatibility or future plans, use /address@hidden@*/ in 
the
  argument declaration. (-paramuse will suppress message)
actions.c: (in function cmd_source)
actions.c:356:7: Return value (type int) ignored: fclose(fileptr)
actions.c: (in function cmd_generate)
actions.c:389:3: Unqualified storage dpy assigned to implicitly only:
                    ev1.xkey.display = dpy
actions.c:402:3: Return value (type int) ignored: XSendEvent(dpy, ...
actions.c:406:3: Return value (type int) ignored: XSync(dpy, 0)
actions.c:361:21: Parameter data not used
actions.c: (in function cmd_prev)
actions.c:418:26: New fresh storage passed as implicitly temp (not released):
                     find_window_other()
actions.c:426:29: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:433:2: Fresh storage w not released before return
   actions.c:426:7: Fresh storage w allocated
actions.c:410:17: Parameter data not used
actions.c: (in function cmd_prev_frame)
actions.c:445:2: Fresh storage frame not released before return
   actions.c:440:3: Fresh storage frame allocated
actions.c:436:23: Parameter data not used
actions.c: (in function cmd_next)
actions.c:456:26: New fresh storage passed as implicitly temp (not released):
                     find_window_other()
actions.c:464:29: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:471:2: Fresh storage w not released before return
   actions.c:464:7: Fresh storage w allocated
actions.c:448:17: Parameter data not used
actions.c: (in function cmd_next_frame)
actions.c:484:2: Fresh storage frame not released before return
   actions.c:478:3: Fresh storage frame allocated
actions.c:474:23: Parameter data not used
actions.c: (in function cmd_other)
actions.c:497:2: Fresh storage w not released before return
   actions.c:491:3: Fresh storage w allocated
actions.c:487:18: Parameter data not used
actions.c: (in function string_to_window_number)
actions.c:505:24: Test expression for for not boolean, type char: *s
  Test expression type is not boolean. (-predboolothers will suppress message)
actions.c:509:11: Incompatible types for + (int, char): i * 10 + (*s - '0')
  To make char and int types equivalent, use +charint.
actions.c:512:10: Test expression for conditional not boolean, type char: *s
actions.c: (in function cmd_select)
actions.c:526:5: Clauses exit with str referencing fresh storage in true
                    branch, local storage in false branch
   actions.c:524:5: Fresh storage str allocated
actions.c:546:16: New fresh storage passed as implicitly temp (not released):
                     current_screen()
actions.c:546:6: Return value (type int) ignored: show_bar(current...
actions.c:560:2: Fresh storage w not released before return
   actions.c:551:9: Fresh storage w allocated
actions.c: (in function cmd_rename)
actions.c:572:5: Clauses exit with winname referencing fresh storage in true
                    branch, local storage in false branch
   actions.c:570:5: Fresh storage winname allocated
actions.c:577:7: Implicitly only storage not released before assignment:
    current_window()->name = xmalloc(sizeof(char) * strlen(winname) + 1)
actions.c:584:28: New fresh storage passed as implicitly temp (not released):
                     current_screen()
actions.c:574:7: Test expression for if not boolean, type char: *winname
actions.c: (in function cmd_delete)
actions.c:601:3: Unqualified storage wm_protocols assigned to implicitly only:
                    ev.xclient.message_type = wm_protocols
actions.c:592:19: Parameter data not used
actions.c: (in function cmd_kill)
actions.c:615:3: Return value (type int) ignored: XKillClient(dpy,...
actions.c:611:17: Parameter data not used
actions.c: (in function cmd_version)
actions.c:619:20: Parameter data not used
actions.c: (in function command)
actions.c:651:12: Operand of ! is non-boolean (int): !strcmp(cmd, uc->name)
actions.c:653:14: Possibly null storage rest passed as non-null param:
                     uc->func (rest)
   actions.c:644:10: Storage rest may become null
actions.c:660:3: Return value (type char *) ignored: sbuf_copy(buf, "...
  Result returned by function call is not used. If this is intended, can cast
  result to (void) to eliminate message. (-retvalother will suppress message)
actions.c:661:3: Return value (type char *) ignored: sbuf_concat(buf,...
actions.c:662:3: Return value (type char *) ignored: sbuf_concat(buf,...
actions.c:663:3: Return value (type char *) ignored: sbuf_concat(buf,...
actions.c:665:19: New fresh storage passed as implicitly temp (not released):
                     sbuf_get(buf)
actions.c:671:2: Fresh storage buf not released before return
   actions.c:659:3: Fresh storage buf allocated
actions.c: (in function cmd_exec)
actions.c:696:5: Clauses exit with cmd referencing fresh storage in true
                    branch, local storage in false branch
   actions.c:694:5: Fresh storage cmd allocated
actions.c: (in function spawn)
actions.c:714:7: Unrecognized identifier: putenv
actions.c:715:7: Return value (type int) ignored: execl("/bin/sh",...
actions.c:717:100: Unrecognized (possibly system) identifier: __FUNCTION__
  Identifier used in code has not been declared. (Message repeated for future
  uses in this file.)  Use +gnuextensions to make lclint recognize some
  keywords that are gnu extensions. (-sysunrecog will suppress message)
actions.c:724:8: Null storage passed as non-null param: wait ((int *)0)
actions.c:724:3: Return value (type __pid_t) ignored: wait((int *)0)
actions.c: (in function cmd_newwm)
actions.c:738:5: Clauses exit with prog referencing fresh storage in true
                    branch, local storage in false branch
   actions.c:736:5: Fresh storage prog allocated
actions.c:743:22: Null storage passed as non-null param: execlp (..., 0)
actions.c:743:3: Return value (type int) ignored: execlp(prog, pro...
actions.c: (in function cmd_quit)
actions.c:754:16: Parameter data not used
actions.c: (in function cmd_clock)
actions.c:774:3: Assignment of int to char: msg[strlen(tmp) - 1] = 0
  Types are incompatible. (-type will suppress message)
actions.c:765:18: Parameter data not used
actions.c: (in function cmd_number)
actions.c:794:33: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:802:46: Variable str used before definition
  An rvalue is used that may not be initialized to a value on some execution
  path. (-usedef will suppress message)
actions.c:821:7: Return value (type int) ignored: add_window_numbe...
actions.c:824:25: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:825:25: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:828:28: New fresh storage passed as implicitly temp (not released):
                     current_screen()
actions.c: (in function cmd_windows)
actions.c:842:8: Operand of ! is non-boolean (int): !hide_bar(s)
actions.c:842:22: Return value (type int) ignored: show_bar(s)
actions.c:843:2: Fresh storage s not released before return
   actions.c:840:3: Fresh storage s allocated
actions.c:836:20: Parameter data not used
actions.c: (in function cmd_abort)
actions.c:847:18: Parameter data not used
actions.c: (in function cmd_maximize)
actions.c:868:19: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:866:21: Parameter data not used
actions.c: (in function cmd_escape)
actions.c:887:4: Implicitly only storage action->key not released before
                    assignment: action->key = key->sym
actions.c:889:2: Storage key->sym is kept in one path, but live in another.
   actions.c:887:4: Storage key->sym becomes kept
actions.c:892:48: Function find_keybinding expects arg 2 to be int gets
                     unsigned int: prefix_key.state
actions.c:895:4: Implicitly only storage action->key not released before
                    assignment: action->key = key->sym
actions.c:908:7: Implicitly only storage prefix_key.sym not released before
                    assignment: prefix_key.sym = key->sym
actions.c:923:2: Fresh storage key not released before return
   actions.c:879:3: Fresh storage key allocated
actions.c: (in function cmd_h_split)
actions.c:933:20: Parameter data not used
actions.c: (in function cmd_v_split)
actions.c:939:20: Parameter data not used
actions.c: (in function cmd_only)
actions.c:948:13: New fresh storage passed as implicitly temp (not released):
                     current_window()
actions.c:945:17: Parameter data not used
actions.c: (in function cmd_remove)
actions.c:963:2: Fresh storage frame not released before return
   actions.c:956:3: Fresh storage frame allocated
actions.c:952:19: Parameter data not used
actions.c: (in function cmd_banish)
actions.c:973:3: Return value (type int) ignored: XWarpPointer(dpy...
actions.c:974:2: Fresh storage s not released before return
   actions.c:971:3: Fresh storage s allocated
actions.c:967:19: Parameter data not used
actions.c: (in function cmd_curframe)
actions.c:977:21: Parameter data not used
actions.c: (in function cmd_help)
actions.c:995:3: Return value (type int) ignored: XMapRaised(dpy, ...
actions.c:997:3: Return value (type int) ignored: XGetInputFocus(d...
actions.c:998:3: Return value (type int) ignored: XSetInputFocus(d...
actions.c:1000:3: Return value (type int) ignored: XDrawString(dpy,...
actions.c:1006:3: Return value (type int) ignored: XDrawString(dpy,...
actions.c:1011:3: Return value (type int) ignored: XDrawString(dpy,...
actions.c:1023:7: Return value (type int) ignored: XDrawString(dpy,...
actions.c:1034:7: Return value (type int) ignored: XDrawString(dpy,...
actions.c:1049:3: Return value (type int) ignored: XMaskEvent(dpy, ...
actions.c:1050:3: Return value (type int) ignored: XUnmapWindow(dpy...
actions.c:1051:24: Variable fwin used before definition
actions.c:1051:30: Variable revert used before definition
actions.c:1051:3: Return value (type int) ignored: XSetInputFocus(d...
actions.c:1052:2: Fresh storage s not released before return
   actions.c:985:37: Fresh storage s allocated
actions.c:983:17: Parameter data not used
bar.c: (in function hide_bar)
bar.c:48:7: Return value (type int) ignored: XUnmapWindow(dpy...
bar.c:45:7: Test expression for if not boolean, type int: s->bar_is_raised
  Test expression type is not boolean or int. (-predboolint will suppress
  message)
bar.c: (in function show_bar)
bar.c:59:8: Operand of ! is non-boolean (int): !s->bar_is_raised
bar.c:62:7: Return value (type int) ignored: XMapWindow(dpy, ...
bar.c:66:7: Return value (type unsigned int) ignored: alarm(5)
bar.c: (in function bar_y)
bar.c:86:7: Test expression for if not boolean, type int: 3 % 2
bar.c: (in function update_window_names)
bar.c:105:5: Only storage assigned to unqualified static:
                bar_buffer = sbuf_new(0)
  The only reference to this storage is transferred to another reference (e.g.,
  by returning it) that does not have the only annotation. This may lead to a
  memory leak, since the new reference is not necessarily released. (-onlytrans
  will suppress message)
bar.c:107:3: Return value (type char *) ignored: sbuf_clear(bar_b...
bar.c:118:23: New fresh storage passed as implicitly temp (not released):
                 sbuf_get(bar_buffer)
bar.c:118:2: Assignment of size_t to int:
                mark_start = strlen(sbuf_get(bar_buffer))
  To allow arbitrary integral types to match any integral type, use
  +matchanyintegral.
bar.c:120:7: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:123:7: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:126:2: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:128:2: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:130:2: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:132:7: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:134:7: Return value (type char *) ignored: sbuf_concat(bar_...
bar.c:137:21: New fresh storage passed as implicitly temp (not released):
                 sbuf_get(bar_buffer)
bar.c:137:2: Assignment of size_t to int:
                mark_end = strlen(sbuf_get(bar_buffer))
bar.c:140:16: New fresh storage passed as implicitly temp (not released):
                 sbuf_get(bar_buffer)
bar.c:140:8: Operand of ! is non-boolean (int):
                !strcmp(sbuf_get(bar_buffer), "")
bar.c:142:7: Return value (type char *) ignored: sbuf_copy(bar_bu...
bar.c:145:19: New fresh storage passed as implicitly temp (not released):
                 sbuf_get(bar_buffer)
bar.c:146:2: Fresh storage other_window not released before return
   bar.c:109:3: Fresh storage other_window allocated
bar.c: (in function marked_message)
bar.c:162:8: Operand of ! is non-boolean (int): !s->bar_is_raised
bar.c:165:7: Return value (type int) ignored: XMapWindow(dpy, ...
bar.c:169:3: Return value (type unsigned int) ignored: alarm(5)
bar.c:171:3: Return value (type int) ignored: XMoveResizeWindo...
bar.c:176:3: Return value (type int) ignored: XClearWindow(dpy...
bar.c:177:3: Return value (type int) ignored: XRaiseWindow(dpy...
bar.c:179:3: Return value (type int) ignored: XDrawString(dpy,...
bar.c:202:7: Assignment of long int to unsigned long int:
                mask = (1L << 2) | (1L << 0)
bar.c:205:7: Return value (type int) ignored: XFillRectangle(d...
bar.c:208:7: Fresh storage lgc not released before assignment:
                lgc = XCreateGC(dpy, s->root, mask, &lgv)
   bar.c:203:7: Fresh storage lgc allocated
bar.c:210:7: Return value (type int) ignored: XFillRectangle(d...
bar.c:212:2: Fresh storage lgc not released before return
   bar.c:208:7: Fresh storage lgc allocated
bar.c:212:2: Fresh storage s not released before return
   bar.c:154:38: Fresh storage s allocated
communications.c: (in function send_restart)
communications.c:37:3: Unqualified storage ((&((_XPrivDisplay)dpy)->screens[(((_
    XPrivDisplay)dpy)->default_screen)])->root) assigned to implicitly only:
    ev.xclient.window = ((&((_XPrivDisplay)dpy)->screens[(((_XPrivDisplay)dpy)->
    default_screen)])->root)
communications.c:38:3: Unqualified storage rp_restart assigned to implicitly
                          only: ev.xclient.message_type = rp_restart

(lclint segfaulted here :)

Cheers,
-- 
Gergely Nagy \ mhp/|8]

Attachment: pgpnnXPz_rUWM.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]