Open
Conversation
SloCompTech
previously approved these changes
Sep 19, 2018
Contributor
SloCompTech
left a comment
There was a problem hiding this comment.
I built library and found out that mentioned warnings, errors are fixed in this pull request.
darconeous
reviewed
Oct 29, 2019
| #cmakedefine HAVE_COREFOUNDATION_COREFOUNDATION_H @_HAVE_COREFOUNDATION_COREFOUNDATION_H@ | ||
|
|
||
| #ifdef HAVE_ENDIAN_H | ||
| #define _DEFAULT_SOURCE |
Member
There was a problem hiding this comment.
What is this macro and why is it necessary?
Author
There was a problem hiding this comment.
It is needed to since glib 2.19, otherwise we get a implicit declaration function
(Sorry I did not get any notification of this...)
examples/CMakeLists.txt
Outdated
| @@ -1,4 +1,6 @@ | |||
| set(EXAMPLES-SOURCES | |||
| felica-lite-dump | |||
| felica-read-ndef | |||
Member
There was a problem hiding this comment.
Whitespace is different for these lines compared to other lines.
felica-lite-dump, felica-read-ndef and mifare-ultralightc-diversify were present on autoconf but not on cmake Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Fixes warning:
Scanning dependencies of target freefare
[ 1%] Building C object libfreefare/CMakeFiles/freefare.dir/felica.c.o
/tmp/libfreefare/libfreefare/felica.c: In function ‘felica_tag_new’:
/tmp/libfreefare/libfreefare/felica.c:50:16: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
if ((tag = malloc(sizeof(struct felica_tag)))) {
^~~~~~
/tmp/libfreefare/libfreefare/felica.c:50:16: warning: incompatible implicit declaration of built-in function ‘malloc’
/tmp/libfreefare/libfreefare/felica.c:50:16: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
/tmp/libfreefare/libfreefare/felica.c:26:1:
+#include <stdlib.h>
/tmp/libfreefare/libfreefare/felica.c:50:16:
if ((tag = malloc(sizeof(struct felica_tag)))) {
^~~~~~
/tmp/libfreefare/libfreefare/felica.c: In function ‘felica_tag_free’:
/tmp/libfreefare/libfreefare/felica.c:64:5: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
free(tag);
^~~~
/tmp/libfreefare/libfreefare/felica.c:64:5: warning: incompatible implicit declaration of built-in function ‘free’
/tmp/libfreefare/libfreefare/felica.c:64:5: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
From man be32toh:
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
htobe16(), htole16(), be16toh(), le16toh(), htobe32(), htole32(), be32toh(), le32toh(),
htobe64(), htole64(), be64toh(), le64toh():
Since glibc 2.19:
_DEFAULT_SOURCE
In glibc up to and including 2.19:
_BSD_SOURCE
Fixes build error:
[ 59%] Building C object examples/CMakeFiles/felica-read-ndef.dir/felica-read-ndef.c.o
/tmp/libfreefare/examples/felica-read-ndef.c: In function ‘main’:
/tmp/libfreefare/examples/felica-read-ndef.c:113:21: warning: implicit declaration of function ‘be32toh’ [-Wimplicit-function-declaration]
payload_length = be32toh(*(uint32_t *)(ndef_record + 2));
^~~~~~~
[ 61%] Linking C executable felica-read-ndef
/usr/bin/ld: CMakeFiles/felica-read-ndef.dir/felica-read-ndef.c.o: in function `main':
felica-read-ndef.c:(.text+0x319): undefined reference to `be32toh'
collect2: error: ld returned 1 exit status
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.