Subject: lint(1) prototypes warnings with numbers on 64bit platforms
To: NetBSD help <netbsd-help@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: netbsd-help
Date: 12/03/2004 19:14:03
Hi,

As a software developper, i often run lint(1) on my C
sources. Recently, i discovered that NetBSD lint give diffrent results
on 32/64 bit platforms (-current).

Here is a small example, to illustrate the case i'm facing :

njoly@lanfeust [tmp/xx]> cat lint.c
#include <string.h>

int main() {
  const char *a = "123456789";
  const char *b = "123";
  size_t s = 3;

  if (strncmp(a, b, 3) != 0) {
    return 1; }
  if (strncmp(a, b, (size_t)3) != 0) {
    return 1; }
  if (strncmp(a, b, s) != 0) {
    return 1; }

  return 0; }

The first `strncmp' line issue a warning on 64 bit hosts (the others
are workaround tests).

njoly@lanfeust [tmp/xx]> uname -m
amd64
njoly@lanfeust [tmp/xx]> lint lint.c
lint.c:
lint.c(8): warning: conversion to 'unsigned long' due to prototype, arg #3 [259]
Lint pass2:

njoly@thanos [~]> uname -m
alpha
njoly@thanos [~]> lint lint.c
lint.c:
lint.c(8): warning: conversion to 'unsigned long' due to prototype, arg #3 [259]
Lint pass2:

njoly@hal [~/tmp]> uname -m
i386
njoly@hal [~/tmp]> lint lint.c
lint.c:
Lint pass2:

Do i miss something, or our lint program should not issue a warning
with numbers in this case ?

Thanks in advance,
Regards.

NB: I tested the Tru64 lint(1) program, and got no warning for that.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.