Changes to make Etoile compile with Clang
Updated 5 months, 3 weeks ago
| Truls Becken | Reviewers | ||
| EtoileCore | |||
| TheRaven | |||
| None | Etoile trunk (etoile/trunk/Etoile) | ||
This rather huge patch makes Étoilé build with make CC=clang CXX=clang++. David said four months ago that everything compiled, but development happened since, and Clang is not as forgiving as GCC. Please see my comments in the patch, which explains some things and asks some questions.
Posted 5 months, 4 weeks ago (March 14th, 2010, 8:34 a.m.)
-
./Bundles/EtoileWildMenus/NSMenu+Hackery.m (Diff revision 1) -
In a number of places, NSDebugLog() is called with an extra argument in front. I guess this has always been wrong, but GCC does not warn you that the arguments do not match up with the format string, like Clang does.
-
./Developer/Services/CodeMonkey/Controller.m (Diff revision 1) -
Clang is very strict about the types of format parameters. Here it has to be %@, not %x.
-
./Developer/Services/CodeMonkey/IDE.h (Diff revision 1) -
Clang is more picky about forward references, and needs to actually import the interface more often.
-
./Frameworks/AddressesKit/Frameworks/Addresses/ADLocalAddressBook.m (Diff revision 1) -
Since "next" is an unsigned long, %d is not good enough. It actually has to be %ld, or Clang complains.
-
./Frameworks/AddressesKit/Frameworks/Addresses/ADPerson.m (Diff revision 1) -
To please Clang, I could just have added the missing comma here, but the log message does not make sense so I fixed that as well.
-
./Frameworks/CoreObject/COMultiValue.m (Diff revision 1) -
The big issue here is that the code was comparing pointers to strings rather than comparing their content. We can avoid using strcmp because we know we only need to check the first character.
-
./Frameworks/EtoileFoundation/Headers/EtoileCompatibility.h (Diff revision 1) -
__builtin_truncf() does not exist for Clang, just removing this define worked for me on Linux. I do not know if <math.h> always works, but it did for me, and it seems better to rely on that than on the compiler being GCC, at least. This change was done in 3 places.
-
./Frameworks/EtoileFoundation/Source/NSObject+Prototypes.m (Diff revision 1) -
This change has been sitting in my tree for a long time, but it was not as clean before because I had to copy method_getTypeEncoding() and class_getInstanceMethod() from RuntimeAbstraction to use them here. Thankfully, they are now exposed from libobjc2, and ObjectiveC2 when not using that.
-
./Frameworks/EtoileSerialize/GNUmakefile (Diff revision 1) -
Programs using EtoileSerialize got linker errors with missing symbols from EtoileXML. Adding this direct linkage fixed the issue for me, although it seems a little strange that this is necessary when EtoileFoundation already links in EtoileXML.
-
./Frameworks/EtoileSerialize/Headers/ETSerializerBackend.h (Diff revision 1) -
Types need to match, (const char *) is not the same as (char *).
-
./Frameworks/EtoileSerialize/Sources/NSInvocation+ETSerializable.m (Diff revision 1) -
Need to cast to char*, which means macro STORE_FIELD cannot be used for this one :-/
-
./Frameworks/LuceneKit/Source/Document/LCNumberTools.m (Diff revision 1) -
I guess somebody forgot to decide which one to use of bzero() and memset(). With Clang, using bzero() requires an include. Btw, doesn't this memset() fill the buffer with a non-zero character?
-
./Frameworks/ObjectiveC2/runtime.h (Diff revision 1) -
Clang does not allow redefining macros, so #undef them first.
-
./Frameworks/OgreKit/GNUmakefile (Diff revision 1) -
OgreKit uses some AppKit classes.
-
./Frameworks/OgreKit/Headers/OgreTextFindThread.h (Diff revision 1) -
Moved out in a separate header to be imported in OgreTextFindProgressSheet.h
-
./Frameworks/PopplerKit/bindings/GNUmakefile (Diff revision 1) -
-
./Languages/LanguageKit/CodeGen/CodeGenLexicalScope.cpp (Diff revision 1) -
Please ignore my changes to this file, David has fixed the code I commented out.
-
./Languages/LanguageKit/CodeGen/CodeGenModule.cpp (Diff revision 1) -
Please ignore my changes to this file, David has fixed the code I commented out.
-
./Languages/LanguageKit/LKInterpreter.m (Diff revision 1) -
Moved to Runtime/BlockClosure.h
-
./Languages/LanguageKit/LKInterpreter.m (Diff revision 1) -
It was actually GCC, not Clang, that complained about uninitialized variables.
-
./Services/Private/Azalea/render/theme.m (Diff revision 1) -
Clang does not allow conditionals without any code to execute when the test succeeds.
-
./Services/Private/System/EtoileSystem.m (Diff revision 1) -
I don't know what this underscore was for, but Clang did not like it.
-
./Services/Private/System/SCTask.m (Diff revision 1) -
Does GCC perform some concatenation here that Clang does not? Is it better to add the comma and keep the short lines, or join the strings into one?
-
./Services/User/DictionaryReader/DictConnection.m (Diff revision 1) -
NSObject declares (NSUInteger) hash; which is the same as unsigned int, not unsigned long.
Posted 5 months, 4 weeks ago (March 14th, 2010, 8:39 a.m.)
Posted 5 months, 4 weeks ago (March 14th, 2010, 8:44 a.m.)
Review request changed
Updated 5 months, 4 weeks ago (March 14th, 2010, 10:05 a.m.)
-
- added Diff r2
Review request changed
Updated 5 months, 4 weeks ago (March 14th, 2010, 12:14 p.m.)
-
- added Diff r3