[SERVER-1267] BSON (and other) client headers should include cleanly in any context. Created: 21/Jun/10 Updated: 12/Jul/16 Resolved: 07/Sep/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | 1.5.3 |
| Fix Version/s: | 1.7.1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Andrew Morrow (Inactive) | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Participants: |
| Description |
|
Many of the client facing headers in mongodb use system functions without including the headers that define those functions: mongo/bson/bsonobjbuilder.h for instance, uses 'pow', but does not include <cmath>, uses 'strlen', but does not include <cstring>, etc. Similarly, the BSON headers are not complete among themselves: bsonobjbuilder.h uses util/builder.h, but does not include it. Every client facing header should compile cleanly if included as the only text in a .cc file. |
| Comments |
| Comment by auto [ 07/Sep/10 ] |
|
Author: {'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}Message: Ensure client headers include cleanly in any context |
| Comment by Mathias Stearn [ 07/Sep/10 ] |
|
we are now testing for bson.h and dbclient.h. Are there any other important ones? |
| Comment by Andrew Morrow (Inactive) [ 28/Jul/10 ] |
|
Yes, a test would be good. I realize this fixing all of the headers is a fairly big undertaking. But maybe you could add some dummy .cc files for each of the 'critical' user facing headers, and have those .cc files only include the associated header? So you could have bson.cc, and all it would do would be to #include "bson.h". Maybe something similar for dbclient.h and dbclientcursor.h. Just hit the big ones for now to get 1.5 out the door with at least some sort of way of finding that you broke some important client headers before committing. Right now the 1.5 C++ driver headers are very fragile and often unusable in client context. |
| Comment by Eliot Horowitz (Inactive) [ 28/Jul/10 ] |
|
Would be nice to eventually have a test for this. |
| Comment by Andrew Morrow (Inactive) [ 27/Jul/10 ] |
|
I'd like to re-emphasize the importance of this ticket. This change http://github.com/mongodb/mongo/commit/585b3797ff5aa6702e837ed7d87ac09a720e5793 introduced a dependency in bson.h on bson::StringBuilder, but didn't include the headers for it, which breaks all code which includes bson.h as the first of its mongo includes. I realize that the include environment is probably different for files compiled within the server, and the tree does build cleanly with this change, but for those headers which are exposed as part of the client or driver API, each one needs to explicitly include headers for everything it uses. |