[SERVER-18373] MONGO_COMPILER_UNREACHABLE should terminate if violated Created: 07/May/15  Updated: 08/Jan/16  Resolved: 15/May/15

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.0.9, 3.1.3

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

Issue Links:
Duplicate
is duplicated by SERVER-18343 'control reaches end of non-void func... Closed
Backwards Compatibility: Fully Compatible
Backport Completed:
Sprint: Platform 3 05/15/15
Participants:

 Description   

The current MONGO_COMPILER_UNREACHABLE simply uses __builtin_unreachable, however if control does flow past it then the behavior is undefined.

We would prefer to terminate. We should write a new macro MONGO_UNREACHABLE, that invokes invariantFailed or similar. Optionally, the macro could follow that call to invariantFailed with __builtin_unreachable, however this should probably be unnecessary, as whatever function is called by the macro should be tagged noreturn.



 Comments   
Comment by Githook User [ 08/Jan/16 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-18373 SERVER-18219 add MONGO_UNREACHABLE macro where compiler cannot deduce that WCE retry loops will return
Branch: v3.0
https://github.com/mongodb/mongo/commit/4f7b4de66892c74adc0817776ec059b13678de64

Comment by Githook User [ 15/May/15 ]

Author:

{u'username': u'amidvidy', u'name': u'Adam Midvidy', u'email': u'amidvidy@gmail.com'}

Message: SERVER-18373 implement UNREACHABLE using invariantFailed so we know how it fails
Branch: master
https://github.com/mongodb/mongo/commit/f3c262d1ab45e6fa59cd84ea90a150bde3372dd0

Generated at Thu Feb 08 03:47:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.