git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add support for uintmax_t type on FreeBSD 4.9

From
David Syzdek <syzdek@gmail.com>
Date
Oct 27, 2008, 13:23 UTC
Message-ID
<9a0027270810270623h4c0c34d0vcd92f61edff6da5@mail.gmail.com>
In-Reply-To
<7v1vy2imt2.fsf@gitster.siamese.dyndns.org>
On Sun, Oct 26, 2008 at 10:17 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 49 quoted lines
> "David Syzdek" <syzdek@gmail.com> writes:
>
>> On Sun, Oct 26, 2008 at 9:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> ...
>>> I have a stupid question.
>>>
>>> Would it be a more appropriate improvement to do it like this:
>>>
>>>        ifdef USE_THIS_AS_UINTMAX_T
>>>            BASIC_CFLAGS += -Duintmax_t="$(USE_THIS_AS_UINTMAX_T)"
>>>        endif
>>>
>>> and then add a section for FreeBSD 4.9-SECURITY like this:
>>>
>>>        ifeq ($(uname_R),4.9-SECURITY)
>>>                USE_THIS_AS_UINTMAX_T = uint32_t
>>>        endif
>>>
>>> That way, an oddball 64-bit machine can use uint64_t here if it wants to,
>>> possibly including FreeBSD 4.9-SECURITY backported to 64-bit ;-).
>>>
>>
>> Your suggestion provides more flexibility for other environments. I
>> was making the assumption that 64-bit systems would define uintmax_t,
>> however in retrospect that would be unwise.
>> Would you like me to resubmit the patches with your modifications?
>
> Actually there was a reason why I said this was a "stupid" question.  I
> think your assumption on 64-bit platforms would hold in practice, and my
> suggestion could be an unnecessary overengineering.  If nobody knows of a
> system that would benefit from such a generalization, your original patch
> would be better, partly because I think:
>
>  (1) USE_THIS_AS_UINTMAX_T is just for demonstration of concept and is a
>     terrible name we cannot possibly use in our Makefile.  We have to
>     spend brain cycles to come up with a better name; and
>
>  (2) It may be tricky to come up with autoconf macros to determine what to
>     set USE_THIS_AS_UINTMAX_T to.
>
> As a slightly unrelated aside, I find it somewhat unfortunate that the
> conditional says "4.9-SECURITY", which is a bit too explicit and specific.
> to my taste.  I do not know how FreeBSD versioning scheme works, but
> wouldn't your change work equally well for 4.9-RELEASE or 4.11-RELEASE?
>
> I suspect that you would want to say "$(uname_R) that begins with '4.' or
> smaller needs this workaround", as strtoul(3) manual page seems to appear
> first in FreeBSD 5.0-RELEASE (but not found in FreeBSD 4.11-RELEASE).
>
The following should match against FreeBSD 4.x:
	FREEBSD_MAJOR := $(shell sh -c 'echo $(uname_R) |cut -d. -f1')
	ifeq ($(FREEBSD_MAJOR),4)
		NO_UINTMAX_T = YesPlease
		NO_STRTOUMAX = YesPlease
	endif
Is the use of FREEBSD_MAJOR okay, or would another name be more appropriate?
-- 
An earthquake wiped out Etchisketchistan today.
   -- Onion TV
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “Add support for uintmax_t type on FreeBSD 4.9”
  1. Add support for uintmax_t type on FreeBSD 4.9David M. Syzdek, Oct 26, 2008
  2. Junio C HamanoOct 27, 2008
  3. David SyzdekOct 27, 2008
  4. Junio C HamanoOct 27, 2008
  5. David SyzdekOct 27, 2008
  6. Junio C HamanoOct 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.