Compile-time Error: control may reach end of non-void function with Xcode 10.2
See original GitHub issueTL;DR
Thanks @AidenMontgomery.
- Open the source file at ${RN_PROJ}/node_modules/realm/src/jsc/jsc_value.hpp.
- Find the switch-case segment at THERE.
- Replace the whole switch-case segment with the following code.
    switch (JSValueGetType(ctx, value)) {
        case kJSTypeNull: return "null";
        case kJSTypeNumber: return "number";
        case kJSTypeObject: return "object";
        case kJSTypeString: return "string";
        case kJSTypeBoolean: return "boolean";
        case kJSTypeUndefined: return "undefined";
        case kJSTypeSymbol: return "symbol";
    }
Goals
When I were compiling the React Native Project with Xcode, the compiler prompts an error.
Expected Results
No error.
Actual Results
/Users/***/***/***/node_modules/realm/src/jsc/jsc_value.hpp:54:1: error: control may reach end of non-void function [-Werror,-Wreturn-type]
Version of Realm and Tooling
- Realm JS SDK Version: 2.25.0
- React Native: 0.58.6
- Node: 10.15.2
- Client OS & Version: iOS 12.2.0
Temp Solution
- Open the source code: ${RN_PROJ}/node_modules/realm/src/jsc/jsc_value.hpp;
- Add return "null";between line 33 and 34.
I know this is not a good solution. So I am looking forward to the official solution.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:31
- Comments:21 (5 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
Error: control may reach end of non-void function in C
You are getting this error because if your for loop breaks due to breaking condition i < n; then it don't find any...
Read more >[Solved]-Control may reach end of non-void function ERROR
Solution: Try making their (return) type bool and see if it fixes it. Otherwise, consider returning an error value at the end of...
Read more >How to solve "control may reach end of non void function" error
There are a few ways to fix this. The most direct solution is to add a return statement at the end of the...
Read more >Xcode 14 Release Notes | Apple Developer Documentation
Workaround: Quit and relaunch Xcode. CGFLOAT_EPSILON is no longer always type Float on watchOS, and it may cause compile issues. (88698530). Workaround: ...
Read more >C++ Users Guide - Oracle Help Center
Complex Arithmetic Library Functions Default Error Handling 15–7 ... The C++ compiler package consists of a front end, optimizer, ...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

temp solution :
add
default: return "null";between line 52 and 53,this working for me, waiting for the official solution
From what I can tell, and I’m probably wrong, there is a new entry in the JSType Enum kJSTypeSymbol which is not being handled in the switch statement. Therefore the switch is not handling all of the possible values returned by JSValueGetType
I don’t know what the effect of doing this will be, but I think that the solution is as follows…
This does mean that when/if a new value is added to the Enum again we will see the same issue, unless there is a default added, I just don’t know what that should do.