From owner-freebsd-current@FreeBSD.ORG Tue Nov 1 07:10:54 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 791BA1065680 for ; Tue, 1 Nov 2011 07:10:54 +0000 (UTC) (envelope-from loox@e-shell.net) Received: from mail.serpronet.com (mail.serpronet.com [64.214.84.187]) by mx1.freebsd.org (Postfix) with ESMTP id ED5098FC0C for ; Tue, 1 Nov 2011 07:10:47 +0000 (UTC) Received: by mail.serpronet.com (Postfix, from userid 506) id 264B0C4C37; Tue, 1 Nov 2011 01:10:46 -0600 (CST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on titan.serpronet.com X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 Received: from twinmoon.e-shell.net (unknown [10.1.10.180]) by mail.serpronet.com (Postfix) with ESMTP id 760EDC4C30; Tue, 1 Nov 2011 01:10:42 -0600 (CST) Received: from moonlight.e-shell.tk (unknown [189.247.245.165]) by twinmoon.e-shell.net (Postfix) with ESMTPSA id 09FA317021; Tue, 1 Nov 2011 01:12:01 -0600 (CST) From: Axel Gonzalez To: Roman Divacky Date: Tue, 01 Nov 2011 01:10:36 -0600 Message-ID: <2104381.NqWTZMXtng@moonlight.e-shell.tk> User-Agent: KMail/4.7.1 (FreeBSD/9.0-RC1; KDE/4.7.2; i386; ; ) In-Reply-To: <20111101065651.GA27751@freebsd.org> References: <1562351.Ln9lEKl2rv@moonlight.e-shell.tk> <20111101065651.GA27751@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 07:10:54 -0000 Here is the output (short version): ... (snip) static __inline __uint16_t __bswap16_var(__uint16_t _x) { return ((__uint16_t)((_x) << 8 | (_x) >> 8)); } ... (snip) int main() { uint16_t x = (__builtin_constant_p(80) ? (__uint16_t)(((__uint16_t)(80)) << 8 | ((__uint16_t)(80)) >> 8) : __bswap16_var(80)); printf("%hu\n", (uint16_t)(__builtin_constant_p(x) ? (__uint16_t) (((__uint16_t)(x)) << 8 | ((__uint16_t)(x)) >> 8) : __bswap16_var(x))); printf("%hu\n", (__builtin_constant_p(x) ? (__uint16_t)(((__uint16_t)(x)) << 8 | ((__uint16_t)(x)) >> 8) : __bswap16_var(x))); return (0); } % clang -E ntohs.c > ntohs_.c % clang -Wall -o ntohs ntohs_.c In file included from ntohs.c:1: ntohs.c:8:12: warning: conversion specifies type 'unsigned short' but the argument has type 'int' [-Wformat] ...%hu\n", (__builtin_constant_p(x) ? (__uint16_t)(((__uint16_t)(x)) << 8 | ((__uint16_t)(x)) >> 8) : __bswap16_var(x))... ~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %d 1 warning generated. And I missed it the first mail: FreeBSD moonlight 9.0-RC1 FreeBSD 9.0-RC1 #0: Fri Oct 28 22:53:45 CDT 2011 toor@moonlight:/usr/obj/usr/src/sys/LXCORE9 i386 Thanks! A On Tuesday 01 November 2011 07:56:51 Roman Divacky wrote: > It doesnt warn here. Can you check with "clang -E" what the ntohs() > is being expanded to and what the real prototype is? > -- Tue Nov 1 01:01:15 2011 GMT ** ***** ****** ******* ******* ****** ***** ** 6.