[CDRIVER-3378] warning: ignoring attributes on template argument Created: 27/Sep/19 Updated: 27/Oct/23 Resolved: 30/Apr/20 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libbson |
| Affects Version/s: | 1.15.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Bozana Hadzic | Assignee: | Kevin Albertson |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux, ubuntu 18.04, x86_64 |
||
| Description |
|
creating vector of bson_t pointers causes warning: "ignoring attributes on template argument ‘bson_t {aka _bson_t*}’ [-Wignored-attributes]"* Example of code:
test_bson_vec.c:13:25: warning: ignoring attributes on template argument ‘bson_t* {aka _bson_t*}’ [-Wignored-attributes] |
| Comments |
| Comment by Kevin Albertson [ 30/Apr/20 ] | |||||||||
|
To follow up, I am able to reproduce this warning with g++ 7.5 on Ubuntu 18.04. Compiling without extra alignment does not resolve the warning, since alignment specifiers are still present (but are reduced to the size of void * instead of 128). There is an open ticket to consider providing an option to disable alignment specifiers altogether ( As far as I know, the warning is not harmful. Wrapping bson_t in a struct silences this warning:
Or alternatively, -Wno-ignored-attributes could be used to ignore the warning of the dropped alignment specifier. As an aside:
Is an improper double initialization. bson_new already initializes the bson_t. Calling bson_init should only be done on a bson_t on the stack, not one created with bson_new. This ends up "converting" the bson_t into thinking it was stack allocated. So the subsequent bson_destroy does not free the bson_t struct itself, resulting in a leak. | |||||||||
| Comment by Kevin Albertson [ 01/Apr/20 ] | |||||||||
|
Apologies for the delayed response. If this is still an issue for you, please respond with the following information. 1. Can you provide the command you are using to compile, and any additional compiler output? |