mainTransport Sample Protocol - Support: sr #108525, gcc warning on RINGBUF_DEFINE

 
 

sr #108525: gcc warning on RINGBUF_DEFINE

Submitter:  David Moreau <dmoreau>
Submitted:  Thu 06 Mar 2014 11:53:11 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  2 - Minor Status:  Done
Privacy:  Public Assigned to:  ptitoliv
Open/Closed:  Closed Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 01 Jun 2014 02:33:01 PM UTC, comment #3: 

Commited in the 0.8.4 branch.

Olivier BONHOMME <ptitoliv>
Group Member
Wed 23 Apr 2014 08:02:45 AM UTC, comment #2: 

I have not made it clear enough.
Gcc warning does not appear during TSP compilation but when we want to build another program which  used RINGBUF_DEFINE() macro (provided by TSP).


David Moreau <dmoreau>
Group Member
Sat 19 Apr 2014 03:35:04 PM UTC, comment #1: 

Hello David,

It doesn't seem possible to reproduce this bug on the master branch. Can you try using the sources stored in the new git master branch and eventually give the steps you executed in order to reproduce this warning ?

Regards,
Olivier

Olivier BONHOMME <ptitoliv>
Group Member
Thu 06 Mar 2014 11:53:11 AM UTC, original submission:  

On CentOS6 with gcc (GCC) 4.4.7 20120313, following call :

RINGBUF_DEFINE      (GTL_Ring_Rcv, gtl_rcv_ring, RINGBUF_SZ(NB_GTL_BUFFER_MAX));

produced a gcc warning :

warning: missing braces around initializer


Following patch is needed to fix warning :


diff --git a/src/core/misc_utils/tsp_ringbuf.h b/src/core/misc_utils/tsp_ringbuf.h
index 449f411..5ecd83f 100755
--- a/src/core/misc_utils/tsp_ringbuf.h
+++ b/src/core/misc_utils/tsp_ringbuf.h
@@ -99,7 +99,7 @@ BEGIN_C_DECLS
 */
 
 #define RINGBUF_DEFINE(TypeName, name, sz) \
- TypeName (name) = { sz, 0, 0, 0, 0 }
+ TypeName (name) = { sz, 0, 0, 0, {0} }
 
 #define RINGBUF_PUT(name, item) \
  { \



David Moreau <dmoreau>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #30796:  tsp.patch added by dmoreau (400B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ptitoliv (Posted a comment)
  • -email is unavailable- added by dmoreau (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-06-01 ptitoliv Open/ClosedOpen Closed
    2014-06-01 ptitoliv StatusNone Done
        Assigned toNone ptitoliv
    2014-03-06 dmoreau Attached File- Added tsp.patch, #30796

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code