public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96907] New: [docs] document builtins for fputc and putc
@ 2020-09-02 20:40 ndesaulniers at google dot com
  2020-09-02 21:01 ` [Bug c/96907] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ndesaulniers at google dot com @ 2020-09-02 20:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

            Bug ID: 96907
           Summary: [docs] document builtins for fputc and putc
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ndesaulniers at google dot com
                CC: rv at rasmusvillemoes dot dk, segher at kernel dot crashing.org
  Target Milestone: ---

In https://reviews.llvm.org/D86508, I'm going through and working on improving
Clang's compatibility with GCC in terms of supported compiler __builtin_
functions.  I noticed that __has_builtin works with putc, __builtin_putc,
fputc, and __builtin_fputc in GCC.  I think putc and fputc could be added to
this page. https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

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

* [Bug c/96907] [docs] document builtins for fputc and putc
  2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
@ 2020-09-02 21:01 ` pinskia at gcc dot gnu.org
  2020-09-03  6:18 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-09-02 21:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
putc was added by g-b53b5aa509

fputc has been there since before 2003.

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

* [Bug c/96907] [docs] document builtins for fputc and putc
  2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
  2020-09-02 21:01 ` [Bug c/96907] " pinskia at gcc dot gnu.org
@ 2020-09-03  6:18 ` rguenth at gcc dot gnu.org
  2020-09-10 21:51 ` segher at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-03  6:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
They are not really "builtins", they are merely present to have default
attributes attached to them.

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

* [Bug c/96907] [docs] document builtins for fputc and putc
  2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
  2020-09-02 21:01 ` [Bug c/96907] " pinskia at gcc dot gnu.org
  2020-09-03  6:18 ` rguenth at gcc dot gnu.org
@ 2020-09-10 21:51 ` segher at gcc dot gnu.org
  2020-09-10 22:00 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: segher at gcc dot gnu.org @ 2020-09-10 21:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |segher at gcc dot gnu.org

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Many other "builtins" documented there are only ever implemented with
libcalls as well?

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

* [Bug c/96907] [docs] document builtins for fputc and putc
  2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
                   ` (2 preceding siblings ...)
  2020-09-10 21:51 ` segher at gcc dot gnu.org
@ 2020-09-10 22:00 ` jakub at gcc dot gnu.org
  2020-09-10 22:19 ` ndesaulniers at google dot com
  2020-09-14 15:06 ` msebor at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-10 22:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For various builtins it isn't merely about default attached attributes, but
also about the compiler understanding what the function does in more detail and
perhaps performing some optimizations on them, transform one function call into
another one, or understand some aliasing etc. behavior of it.
I'm not really sure it is a good idea to document it all.

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

* [Bug c/96907] [docs] document builtins for fputc and putc
  2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
                   ` (3 preceding siblings ...)
  2020-09-10 22:00 ` jakub at gcc dot gnu.org
@ 2020-09-10 22:19 ` ndesaulniers at google dot com
  2020-09-14 15:06 ` msebor at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ndesaulniers at google dot com @ 2020-09-10 22:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

--- Comment #5 from Nick Desaulniers <ndesaulniers at google dot com> ---
No preferences either way.  I was just comparing differences between compilers
for __has_builtin and noticed GCC returns true for those two.  Is that ok?

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

* [Bug c/96907] [docs] document builtins for fputc and putc
  2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
                   ` (4 preceding siblings ...)
  2020-09-10 22:19 ` ndesaulniers at google dot com
@ 2020-09-14 15:06 ` msebor at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-09-14 15:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96907

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
Rather than en enumerating all the functions that are handled as built-ins (and
keeping them in sync with the code) it would be simpler to state that any
function prescribed by this or that revision of a standard may be implemented
as a built-in, and suggesting to use the __has_builtin() preprocessor function
to query support for each.

Besides adding attributes to their declarations, GCC transforms calls to some
of them into others (e.g., fputs to fputc, or fprintf to fputs or fputc) or
eliminated altogether (e.g., fputs("", f)).  It might be helpful to mention
that in the manual and point users who want to avoid such transformations to
-fno-builtin-<name>.

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

end of thread, other threads:[~2020-09-14 15:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02 20:40 [Bug c/96907] New: [docs] document builtins for fputc and putc ndesaulniers at google dot com
2020-09-02 21:01 ` [Bug c/96907] " pinskia at gcc dot gnu.org
2020-09-03  6:18 ` rguenth at gcc dot gnu.org
2020-09-10 21:51 ` segher at gcc dot gnu.org
2020-09-10 22:00 ` jakub at gcc dot gnu.org
2020-09-10 22:19 ` ndesaulniers at google dot com
2020-09-14 15:06 ` msebor at gcc dot gnu.org

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).