public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/16459] New: endian.h does not define byte-order conversion functions
@ 2014-01-16 12:52 jaak at ristioja dot ee
  2014-01-16 19:01 ` [Bug libc/16459] " joseph at codesourcery dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: jaak at ristioja dot ee @ 2014-01-16 12:52 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16459

            Bug ID: 16459
           Summary: endian.h does not define byte-order conversion
                    functions
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: jaak at ristioja dot ee
                CC: drepper.fsp at gmail dot com

"man 3 endian" says it does, but actually it doesn't. If it would, one would be
able to take the address of such a function:

  #define _BSD_SOURCE
  #include <endian.h>

  void g() {
    uint64_t (*f)(uint64_t) = &htole64;
  }

$ gcc -Wimplicit-function-declaration test2.c -c
test.c: In function 'g':
test.c:5:3: warning: implicit declaration of function 'uint64_t'
[-Wimplicit-function-declaration]
test.c:5:14: error: 'f' undeclared (first use in this function)
test.c:5:14: note: each undeclared identifier is reported only once for each
function it appears in
test.c:5:30: error: 'htole64' undeclared (first use in this function)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/16459] endian.h does not define byte-order conversion functions
  2014-01-16 12:52 [Bug libc/16459] New: endian.h does not define byte-order conversion functions jaak at ristioja dot ee
@ 2014-01-16 19:01 ` joseph at codesourcery dot com
  2014-01-16 19:49 ` jaak at ristioja dot ee
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2014-01-16 19:01 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=16459

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
glibc does not provide manpages, and they are not relevant to what glibc's 
interface should be.  (glibc's code should of course be consistent with 
the manual shipped with glibc; I haven't checked what if anything that 
says about these interfaces.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/16459] endian.h does not define byte-order conversion functions
  2014-01-16 12:52 [Bug libc/16459] New: endian.h does not define byte-order conversion functions jaak at ristioja dot ee
  2014-01-16 19:01 ` [Bug libc/16459] " joseph at codesourcery dot com
@ 2014-01-16 19:49 ` jaak at ristioja dot ee
  2014-01-16 20:50   ` Ondřej Bílka
  2014-01-16 20:51 ` neleai at seznam dot cz
  2014-06-13  8:55 ` fweimer at redhat dot com
  3 siblings, 1 reply; 6+ messages in thread
From: jaak at ristioja dot ee @ 2014-01-16 19:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16459

--- Comment #2 from Jaak Ristioja <jaak at ristioja dot ee> ---
(In reply to joseph@codesourcery.com from comment #1)
> glibc does not provide manpages, and they are not relevant to what glibc's 
> interface should be.  (glibc's code should of course be consistent with 
> the manual shipped with glibc; I haven't checked what if anything that 
> says about these interfaces.)

It appears that these interfaces are undocumented in the Texinfo manual.

Why not just add these as functions also, e.g. as done with htons and friends
in <netinet/in.h>:

  extern uint16_t htons (uint16_t __hostshort)
     __THROW __attribute__ ((__const__));

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bug libc/16459] endian.h does not define byte-order conversion functions
  2014-01-16 19:49 ` jaak at ristioja dot ee
@ 2014-01-16 20:50   ` Ondřej Bílka
  0 siblings, 0 replies; 6+ messages in thread
From: Ondřej Bílka @ 2014-01-16 20:50 UTC (permalink / raw)
  To: jaak at ristioja dot ee; +Cc: glibc-bugs

There is flexibility that we could use a function-like macro instead
function. If this needs fixing then by changing pattern

 #   define htobe64(x) __bswap_64 (x)
 #   define htole64(x) (x)

to


 #   define htobe64 __bswap_64
 #   define htole64 __bkeep_64

where __bkeep_64 is a identity function like

static uint64_t
__bkeep_64 (uint64_t x)
{
  return x;
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/16459] endian.h does not define byte-order conversion functions
  2014-01-16 12:52 [Bug libc/16459] New: endian.h does not define byte-order conversion functions jaak at ristioja dot ee
  2014-01-16 19:01 ` [Bug libc/16459] " joseph at codesourcery dot com
  2014-01-16 19:49 ` jaak at ristioja dot ee
@ 2014-01-16 20:51 ` neleai at seznam dot cz
  2014-06-13  8:55 ` fweimer at redhat dot com
  3 siblings, 0 replies; 6+ messages in thread
From: neleai at seznam dot cz @ 2014-01-16 20:51 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=16459

--- Comment #3 from Ondrej Bilka <neleai at seznam dot cz> ---
There is flexibility that we could use a function-like macro instead
function. If this needs fixing then by changing pattern

 #   define htobe64(x) __bswap_64 (x)
 #   define htole64(x) (x)

to


 #   define htobe64 __bswap_64
 #   define htole64 __bkeep_64

where __bkeep_64 is a identity function like

static uint64_t
__bkeep_64 (uint64_t x)
{
  return x;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/16459] endian.h does not define byte-order conversion functions
  2014-01-16 12:52 [Bug libc/16459] New: endian.h does not define byte-order conversion functions jaak at ristioja dot ee
                   ` (2 preceding siblings ...)
  2014-01-16 20:51 ` neleai at seznam dot cz
@ 2014-06-13  8:55 ` fweimer at redhat dot com
  3 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13  8:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16459

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-13  8:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-16 12:52 [Bug libc/16459] New: endian.h does not define byte-order conversion functions jaak at ristioja dot ee
2014-01-16 19:01 ` [Bug libc/16459] " joseph at codesourcery dot com
2014-01-16 19:49 ` jaak at ristioja dot ee
2014-01-16 20:50   ` Ondřej Bílka
2014-01-16 20:51 ` neleai at seznam dot cz
2014-06-13  8:55 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).