mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Carlos R. Mafra" <crmafra@ift.unesp.br>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/time.c: Silence gcc warning 'integer constant to large for long type'
Date: Fri, 2 May 2008 14:14:25 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0805021407030.5994@woody.linux-foundation.org> (raw)
In-Reply-To: <200805021858.m42Iw4Lj025952@tazenda.hos.anvin.org>



On Fri, 2 May 2008, H. Peter Anvin wrote:
> 
> kernel/time.c: In function msecs_to_jiffies:
> kernel/time.c:479: warning: integer constant is too large for long type

Shouldn't we fix the perl-script to mark the constants appropriately 
typed? Ie add the proper "ul" or "ull" endings there as necessary?

For example, I see

	#define MSEC_TO_HZ_ADJ64        0x18000000000000000

in the auto-generated timeconst.h file, and the fact is, that's a really 
really ugly constant. It simply doesn't even fit in a u64. Why do these 
kinds of pointless and useless #define even get generated, when using them 
would inevitably be a bug anyway?

As to the ones that *do* fit in 64 bits, they should still haev the 
correct "ul" and "ull" endings on 64- and 32-bit architectures 
respectively. Yeah, hex constants are always unsigned and the compiler 
will expand them to the right size, but the compiler is also rigth to warn 
about it (and casting them shouldn't even change that fact, even if it 
happens to do so with gcc).

		Linus

  reply	other threads:[~2008-05-02 21:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 18:58 H. Peter Anvin
2008-05-02 21:14 ` Linus Torvalds [this message]
2008-05-02 21:33   ` H. Peter Anvin
2008-05-02 22:17     ` Linus Torvalds
2008-05-02 22:33       ` Linus Torvalds
2008-05-02 22:45         ` H. Peter Anvin
2008-05-02 23:23         ` H. Peter Anvin
2008-05-03 17:57           ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.1.10.0805021407030.5994@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=crmafra@ift.unesp.br \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®