mjansson / foundation_lib

Cross-platform public domain foundation library in C providing basic support data types and functions to write applications and games in a platform-independent fashion.
The Unlicense
301 stars 23 forks source link

Clang warning fixes #8

Closed emoon closed 9 years ago

emoon commented 9 years ago

Bunch of warning fixes for clang.

The math one I get this error:

error: implicit conversion loses floating-point precision: 'double' to 'real' (aka 'float') [-Werror,Wconversion]

emoon commented 9 years ago

Also on Linux I run into this:

0src/external/foundation_lib/foundation/platform.h:871:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
1src/external/foundation_lib/foundation/platform.h:877:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
2src/external/foundation_lib/foundation/platform.h:883:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
3src/external/foundation_lib/foundation/types.h:259:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
4src/external/foundation_lib/foundation/types.h:262:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
5src/external/foundation_lib/foundation/types.h:263:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
6src/external/foundation_lib/foundation/types.h:264:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
7src/external/foundation_lib/foundation/types.h:265:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
8src/external/foundation_lib/foundation/types.h:271:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
9src/external/foundation_lib/foundation/types.h:272:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
10src/external/foundation_lib/foundation/types.h:278:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
11src/external/foundation_lib/foundation/types.h:279:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
12src/external/foundation_lib/foundation/types.h:280:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]
13src/external/foundation_lib/foundation/types.h:281:36: warning: attributes ignored on elaborated-type-specifier that is not a forward declaration [-Wattributes]

I haven't done any fix for as as I'm not sure how you want that code to be.

emoon commented 9 years ago

Another problem is name collision here:

src/external/foundation_lib/foundation/radixsort.h|25 col 43| error: functions that differ only in their return type cannot be overloaded
|| FOUNDATION_API const radixsort_index_t*   radixsort( radixsort_t* sort, const void* input, radixsort_index_t num );
||                      ~~~~~~~~~~~~~~~~~~   ^
/usr/include/stdlib.h|301 col 6| note: previous declaration is here
|| int      radixsort(const unsigned char **, int, const unsigned char *,
|| ~~~      ^

In my case I just comment out the code in the foundation lib (I don't use the code by get the collusion)

mjansson commented 9 years ago

Thanks! I'll sort out the attributes. Not sure about the radixsort, maybe I'll just rename it to radix_sort :)

mjansson commented 9 years ago

Sorted out the redundant align declarations (and added tests for alignments).

Renamed radixsort to radixsort_sort to avoid clashing, and to make it more in line with the general API naming scheme (although the name is a bit redundant now :))

emoon commented 9 years ago

Great! thanks :)