This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] Fix GNU coding style.


On 11/5/18 6:08 PM, Martin Sebor wrote:
> On 11/02/2018 04:37 AM, marxin wrote:
>>
>> gcc/ChangeLog:
>>
>> 2018-11-02  Martin Liska  <mliska@suse.cz>
>>
>>     * mem-stats.h (mem_alloc_description::get_list): Fix GNU coding
>>     style.
>>     * vec.c: Likewise.
> 
> I have no preference here or even know what the style guide calls
> for (nor have I been able to find it) but I've always assumed
> the convention for declaring functions that return pointers (and
> variables of pointer types) was

Hi.

> 
>   T *func (...);

Yes, I also like this format.

> 
> with a space after the type and before the name) as opposed to
> either of:
> 
>   T* func (...);
> or
>   T * func (...);
> 
> The former also appears to be dominant style in GCC.
> 
> So I'm mostly just curious: is there a recommended or preferred
> style or does it not matter?

I'm attaching obvious patch that fixes that. Martin can you please send
a patch to our coding style that will clarify that? And maybe I would also
include how operators should be formatted?

bool operator == (const native_float &b) const
or
bool operator== (const native_float &b) const
or
bool operator ==(const native_float &b) const

Thanks,
Martin

> 
> Thanks
> Martin

>From 857838dc0fa1fca4b47b6f16aef4cd67db85baa3 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 7 Nov 2018 10:05:41 +0100
Subject: [PATCH] Fix GNU coding style (V2).

gcc/ChangeLog:

2018-11-07  Martin Liska  <mliska@suse.cz>

	* mem-stats.h: Fix GNU coding style.
---
 gcc/mem-stats.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h
index 10b41651bf3..7e169d6e9fc 100644
--- a/gcc/mem-stats.h
+++ b/gcc/mem-stats.h
@@ -316,23 +316,23 @@ public:
   bool contains_descriptor_for_instance (const void *ptr);
 
   /* Return descriptor for instance PTR.  */
-  T * get_descriptor_for_instance (const void *ptr);
+  T *get_descriptor_for_instance (const void *ptr);
 
   /* Register memory allocation descriptor for container PTR which is
      described by a memory LOCATION.  */
-  T * register_descriptor (const void *ptr, mem_location *location);
+  T *register_descriptor (const void *ptr, mem_location *location);
 
   /* Register memory allocation descriptor for container PTR.  ORIGIN identifies
      type of container and GGC identifes if the allocation is handled in GGC
      memory.  Each location is identified by file NAME, LINE in source code and
      FUNCTION name.  */
-  T * register_descriptor (const void *ptr, mem_alloc_origin origin,
+  T *register_descriptor (const void *ptr, mem_alloc_origin origin,
 			   bool ggc, const char *name, int line,
 			   const char *function);
 
   /* Register instance overhead identified by PTR pointer. Allocation takes
      SIZE bytes.  */
-  T * register_instance_overhead (size_t size, const void *ptr);
+  T *register_instance_overhead (size_t size, const void *ptr);
 
   /* For containers (and GGC) where we want to track every instance object,
      we register allocation of SIZE bytes, identified by PTR pointer, belonging
@@ -342,7 +342,7 @@ public:
   /* Release PTR pointer of SIZE bytes. If REMOVE_FROM_MAP is set to true,
      remove the instance from reverse map.  Return memory usage that belongs
      to this memory description.  */
-  T * release_instance_overhead (void *ptr, size_t size,
+  T *release_instance_overhead (void *ptr, size_t size,
 				 bool remove_from_map = false);
 
   /* Release intance object identified by PTR pointer.  */
@@ -355,7 +355,7 @@ public:
      are filtered by ORIGIN type, LENGTH is return value where we register
      the number of elements in the list. If we want to process custom order,
      CMP comparator can be provided.  */
-  mem_list_t * get_list (mem_alloc_origin origin, unsigned *length,
+  mem_list_t *get_list (mem_alloc_origin origin, unsigned *length,
 			 int (*cmp) (const void *first,
 				     const void *second) = NULL);
 
-- 
2.19.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]