From owner-freebsd-current@FreeBSD.ORG Tue Nov 1 06:56:58 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD8AC1065670 for ; Tue, 1 Nov 2011 06:56:58 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [46.28.110.116]) by mx1.freebsd.org (Postfix) with ESMTP id 049458FC15 for ; Tue, 1 Nov 2011 06:56:57 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id E33397F3836; Tue, 1 Nov 2011 07:56:51 +0100 (CET) Date: Tue, 1 Nov 2011 07:56:51 +0100 From: Roman Divacky To: Axel Gonzalez Message-ID: <20111101065651.GA27751@freebsd.org> References: <1562351.Ln9lEKl2rv@moonlight.e-shell.tk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1562351.Ln9lEKl2rv@moonlight.e-shell.tk> User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org Subject: Re: Strange warning with clang and 9RC1 (ntohs) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2011 06:56:58 -0000 It doesnt warn here. Can you check with "clang -E" what the ntohs() is being expanded to and what the real prototype is? On Mon, Oct 31, 2011 at 06:35:18PM -0600, Axel Gonzalez wrote: > > I'm getting an strange warning whem compiling with clang (from base) on RC1. > > This warning doesn't appear with 8.X and clang from ports. > > The warning is strange because ntohs is not int: > > uint16_t > ntohs(uint16_t netshort); > > > Any insight would be appreciated, thanks in advance! > > A > > **** > > % gcc -Wall -o ntohs ntohs.c > % clang -Wall -o ntohs ntohs.c > ntohs.c:8:12: warning: conversion specifies type 'unsigned short' but the > argument has type > 'int' [-Wformat] > printf("%hu\n", ntohs(x)); > ~~^ ~~~~~~~~ > %d > 1 warning generated. > > > #include > #include > > int main() > { > uint16_t x = htons(80); > printf("%hu\n", (uint16_t)ntohs(x)); > printf("%hu\n", ntohs(x)); > return (0); > } > > > -- > Mon Oct 31 18:02:13 2011 GMT > > ** > **** > ***** > ****** > ****** > ***** > **** > ** 5. > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"