[SERVER-44856] Turn on -Wunused-exception-parameter for clang builds Created: 26/Nov/19  Updated: 29/Oct/23  Resolved: 03/Dec/19

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.3.3

Type: Improvement Priority: Major - P3
Reporter: Matthew Russotto Assignee: Andrew Morrow (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes SERVER-45067 Fix fuzzer build by removing unused e... Closed
Backwards Compatibility: Fully Compatible
Sprint: Dev Platform 2019-12-16
Participants:

 Description   

Currently our windows builds will fail with an error "C2220" if an exception parameter is unused (e.g. try {} catch (const DBException&e)

{ log() << "whatever"; throw;}

). However non-Windows builds do not fail, resulting in the failure first being noticed on evergreen or worse, after push. Clang has an option -Wunused-exception-parameter; if this was turned on, developers using clang would catch it earlier.

Unfortuately it appears GCC does not have an equivalent.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90353



 Comments   
Comment by Githook User [ 03/Dec/19 ]

Author:

{'name': 'Andrew Morrow', 'email': 'andrew.morrow@10gen.com'}

Message: SERVER-44856 Enable -Wunused-exception-parameter when supported
Branch: master
https://github.com/mongodb/mongo/commit/96f933bd04450a30322efda982c9b58927f08b29

Comment by Andrew Morrow (Inactive) [ 02/Dec/19 ]

I'm happy to try this out. If it works when applied at the top of the tree, then I think we can just commit it. If it would require further work (specifically, if there are third-party libraries which trigger the warning) I'll probably defer it.

Generated at Thu Feb 08 05:07:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.