public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] extend.texi: Fix up defbuiltin* with spaces in return type
@ 2023-12-01 10:26 Jakub Jelinek
  2023-12-01 15:07 ` Jeff Law
  2023-12-01 17:04 ` Sandra Loosemore
  0 siblings, 2 replies; 7+ messages in thread
From: Jakub Jelinek @ 2023-12-01 10:26 UTC (permalink / raw)
  To: Gerald Pfeifer, Joseph Myers, Sandra Loosemore; +Cc: gcc-patches

Hi!

In https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fstdc_005fbit_005ffloor
I've noticed that while e.g. __builtin_stdc_bit_floor builtin is properly
rendered in bold and bigger size, for the __builtin_stdc_bit_width builtin
it is not the builtin name which is marked like that, but the keyword int
before it.  Also, seems such builtins are missing from the index.

I've read the texinfo docs and they seem to suggest in
https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Line-Macros.html
that return types of functions with spaces in the return type should be
wrapped with {}s and we already use that e.g. in
@defbuiltin{{void *} __builtin_thread_pointer (void)}

The following patch adjusts builtins I found which contained one or two
spaces in the return type name (plus two spots which used 2 spaces after
single keyword return type instead of 1 which triggered my search regex as
well).

Tested on x86_64-linux, ok for trunk?

2023-12-01  Jakub Jelinek  <jakub@redhat.com>

	* doc/extend.texi (__builtin_addc, __builtin_addcl, __builtin_addcll,
	__builtin_subc, __builtin_subcl, __builtin_subcll,
	__builtin_stdc_bit_width, __builtin_stdc_count_ones,
	__builtin_stdc_count_zeros, __builtin_stdc_first_leading_one,
	__builtin_stdc_first_leading_zero, __builtin_stdc_first_trailing_one,
	__builtin_stdc_first_trailing_zero, __builtin_stdc_has_single_bit,
	__builtin_stdc_leading_ones, __builtin_stdc_leading_zeros,
	__builtin_stdc_trailing_ones, __builtin_stdc_trailing_zeros,
	__builtin_nvptx_brev, __builtin_nvptx_brevll, __builtin_darn,
	__builtin_darn_raw, __builtin_ia32_vec_ext_v2di,
	__builtin_ia32_crc32qi, __builtin_ia32_crc32hi,
	__builtin_ia32_crc32si, __builtin_ia32_crc32di): Put {}s around
	return type with spaces in it.
	(__builtin_rx_mvfachi, __builtin_rx_mvfacmi): Remove superfluous
	whitespace.

--- gcc/doc/extend.texi.jj	2023-12-01 08:10:42.887322032 +0100
+++ gcc/doc/extend.texi	2023-12-01 11:08:30.968219118 +0100
@@ -13238,9 +13238,9 @@ after addition, conditional jump on carr
  
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_addc (unsigned int a, unsigned int b, unsigned int carry_in, unsigned int *carry_out)}
-@defbuiltinx{unsigned long int __builtin_addcl (unsigned long int a, unsigned long int b, unsigned int carry_in, unsigned long int *carry_out)}
-@defbuiltinx{unsigned long long int __builtin_addcll (unsigned long long int a, unsigned long long int b, unsigned long long int carry_in, unsigned long long int *carry_out)}
+@defbuiltin{{unsigned int} __builtin_addc (unsigned int a, unsigned int b, unsigned int carry_in, unsigned int *carry_out)}
+@defbuiltinx{{unsigned long int} __builtin_addcl (unsigned long int a, unsigned long int b, unsigned int carry_in, unsigned long int *carry_out)}
+@defbuiltinx{{unsigned long long int} __builtin_addcll (unsigned long long int a, unsigned long long int b, unsigned long long int carry_in, unsigned long long int *carry_out)}
 
 These built-in functions are equivalent to:
 @smallexample
@@ -13260,9 +13260,9 @@ emitted if one of them (preferrably the
 
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_subc (unsigned int a, unsigned int b, unsigned int carry_in, unsigned int *carry_out)}
-@defbuiltinx{unsigned long int __builtin_subcl (unsigned long int a, unsigned long int b, unsigned int carry_in, unsigned long int *carry_out)}
-@defbuiltinx{unsigned long long int __builtin_subcll (unsigned long long int a, unsigned long long int b, unsigned long long int carry_in, unsigned long long int *carry_out)}
+@defbuiltin{{unsigned int} __builtin_subc (unsigned int a, unsigned int b, unsigned int carry_in, unsigned int *carry_out)}
+@defbuiltinx{{unsigned long int} __builtin_subcl (unsigned long int a, unsigned long int b, unsigned int carry_in, unsigned long int *carry_out)}
+@defbuiltinx{{unsigned long long int} __builtin_subcll (unsigned long long int a, unsigned long long int b, unsigned long long int carry_in, unsigned long long int *carry_out)}
 
 These built-in functions are equivalent to:
 @smallexample
@@ -15167,7 +15167,7 @@ where @var{prec} is bit width of @var{ty
 in @var{arg} are evaluated just once.
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_bit_width (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_bit_width (@var{type} @var{arg})}
 The @code{__builtin_stdc_bit_width} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15176,7 +15176,7 @@ performed on the argument.  It is equiva
 where @var{prec} is bit width of @var{type}.
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_count_ones (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_count_ones (@var{type} @var{arg})}
 The @code{__builtin_stdc_count_ones} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15184,7 +15184,7 @@ performed on the argument.  It is equiva
 @code{(unsigned int) __builtin_popcountg (@var{arg})}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_count_zeros (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_count_zeros (@var{type} @var{arg})}
 The @code{__builtin_stdc_count_zeros} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15192,7 +15192,7 @@ performed on the argument.  It is equiva
 @code{(unsigned int) __builtin_popcountg ((@var{type}) ~@var{arg})}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_first_leading_one (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_first_leading_one (@var{type} @var{arg})}
 The @code{__builtin_stdc_first_leading_one} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15200,7 +15200,7 @@ performed on the argument.  It is equiva
 @code{__builtin_clzg (@var{arg}, -1) + 1U}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_first_leading_zero (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_first_leading_zero (@var{type} @var{arg})}
 The @code{__builtin_stdc_first_leading_zero} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15208,7 +15208,7 @@ performed on the argument.  It is equiva
 @code{__builtin_clzg ((@var{type}) ~@var{arg}, -1) + 1U}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_first_trailing_one (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_first_trailing_one (@var{type} @var{arg})}
 The @code{__builtin_stdc_first_trailing_one} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15216,7 +15216,7 @@ performed on the argument.  It is equiva
 @code{__builtin_ctzg (@var{arg}, -1) + 1U}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_first_trailing_zero (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_first_trailing_zero (@var{type} @var{arg})}
 The @code{__builtin_stdc_first_trailing_zero} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15224,7 +15224,7 @@ performed on the argument.  It is equiva
 @code{__builtin_ctzg ((@var{type}) ~@var{arg}, -1) + 1U}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_has_single_bit (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_has_single_bit (@var{type} @var{arg})}
 The @code{__builtin_stdc_has_single_bit} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15232,7 +15232,7 @@ performed on the argument.  It is equiva
 @code{(_Bool) (__builtin_popcountg (@var{arg}) == 1)}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_leading_ones (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_leading_ones (@var{type} @var{arg})}
 The @code{__builtin_stdc_leading_ones} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15240,7 +15240,7 @@ performed on the argument.  It is equiva
 @code{(unsigned int) __builtin_clzg ((@var{type}) ~@var{arg}, @var{prec})}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_leading_zeros (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_leading_zeros (@var{type} @var{arg})}
 The @code{__builtin_stdc_leading_zeros} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15248,7 +15248,7 @@ performed on the argument.  It is equiva
 @code{(unsigned int) __builtin_clzg (@var{arg}, @var{prec})}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_trailing_ones (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_trailing_ones (@var{type} @var{arg})}
 The @code{__builtin_stdc_trailing_ones} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -15256,7 +15256,7 @@ performed on the argument.  It is equiva
 @code{(unsigned int) __builtin_ctzg ((@var{type}) ~@var{arg}, @var{prec})}
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_stdc_trailing_zeros (@var{type} @var{arg})}
+@defbuiltin{{unsigned int} __builtin_stdc_trailing_zeros (@var{type} @var{arg})}
 The @code{__builtin_stdc_trailing_zeros} function is available only
 in C.  It is type-generic, the argument can be any unsigned integer
 (standard, extended or bit-precise).  No integral argument promotions are
@@ -18731,11 +18731,11 @@ Disable global interrupt.
 
 These built-in functions are available for the Nvidia PTX target:
 
-@defbuiltin{unsigned int __builtin_nvptx_brev (unsigned int @var{x})}
+@defbuiltin{{unsigned int} __builtin_nvptx_brev (unsigned int @var{x})}
 Reverse the bit order of a 32-bit unsigned integer.
 @enddefbuiltin
 
-@defbuiltin{unsigned long long __builtin_nvptx_brevll (unsigned long long @var{x})}
+@defbuiltin{{unsigned long long} __builtin_nvptx_brevll (unsigned long long @var{x})}
 Reverse the bit order of a 64-bit unsigned integer.
 @enddefbuiltin
 
@@ -19232,8 +19232,8 @@ round to odd as the rounding mode.
 The following additional built-in functions are also available for the
 PowerPC family of processors, starting with ISA 3.0 or later:
 
-@defbuiltin{long long __builtin_darn (void)}
-@defbuiltinx{long long __builtin_darn_raw (void)}
+@defbuiltin{{long long} __builtin_darn (void)}
+@defbuiltinx{{long long} __builtin_darn_raw (void)}
 @defbuiltinx{int __builtin_darn_32 (void)}
 The @code{__builtin_darn} and @code{__builtin_darn_raw}
 functions require a
@@ -22317,12 +22317,12 @@ multiplying the bottom 16 bits of the tw
 accumulator.
 @enddefbuiltin
 
-@defbuiltin{int  __builtin_rx_mvfachi (void)}
+@defbuiltin{int __builtin_rx_mvfachi (void)}
 Generates the @code{mvfachi} machine instruction to read the top
 32 bits of the accumulator.
 @enddefbuiltin
 
-@defbuiltin{int  __builtin_rx_mvfacmi (void)}
+@defbuiltin{int __builtin_rx_mvfacmi (void)}
 Generates the @code{mvfacmi} machine instruction to read the middle
 32 bits of the accumulator.
 @enddefbuiltin
@@ -23691,7 +23691,7 @@ Generates the @code{extractps} machine i
 Generates the @code{pextrd} machine instruction.
 @enddefbuiltin
 
-@defbuiltin{long long __builtin_ia32_vec_ext_v2di (v2di, const int)}
+@defbuiltin{{long long} __builtin_ia32_vec_ext_v2di (v2di, const int)}
 Generates the @code{pextrq} machine instruction in 64bit mode.
 @enddefbuiltin
 
@@ -23720,19 +23720,19 @@ v2di __builtin_ia32_pcmpgtq (v2di, v2di)
 The following built-in functions are available when @option{-msse4.2} is
 used.
 
-@defbuiltin{unsigned int __builtin_ia32_crc32qi (unsigned int, unsigned char)}
+@defbuiltin{{unsigned int} __builtin_ia32_crc32qi (unsigned int, unsigned char)}
 Generates the @code{crc32b} machine instruction.
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_ia32_crc32hi (unsigned int, unsigned short)}
+@defbuiltin{{unsigned int} __builtin_ia32_crc32hi (unsigned int, unsigned short)}
 Generates the @code{crc32w} machine instruction.
 @enddefbuiltin
 
-@defbuiltin{unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int)}
+@defbuiltin{{unsigned int} __builtin_ia32_crc32si (unsigned int, unsigned int)}
 Generates the @code{crc32l} machine instruction.
 @enddefbuiltin
 
-@defbuiltin{unsigned long long __builtin_ia32_crc32di (unsigned long long, unsigned long long)}
+@defbuiltin{{unsigned long long} __builtin_ia32_crc32di (unsigned long long, unsigned long long)}
 Generates the @code{crc32q} machine instruction.
 @enddefbuiltin
 


	Jakub


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

end of thread, other threads:[~2023-12-11  1:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 10:26 [PATCH] extend.texi: Fix up defbuiltin* with spaces in return type Jakub Jelinek
2023-12-01 15:07 ` Jeff Law
2023-12-01 17:04 ` Sandra Loosemore
2023-12-01 17:33   ` Jakub Jelinek
2023-12-01 17:43     ` Sandra Loosemore
2023-12-04  7:36       ` [PATCH] extend.texi: Mark builtin arguments with @var{...} Jakub Jelinek
2023-12-11  1:48         ` Sandra Loosemore

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