Skip to content

Conversation

@ribalda
Copy link

@ribalda ribalda commented Sep 18, 2018

No description provided.

SloCompTech
SloCompTech previously approved these changes Sep 19, 2018
Copy link
Contributor

@SloCompTech SloCompTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built library and found out that mentioned warnings, errors are fixed in this pull request.

#cmakedefine HAVE_COREFOUNDATION_COREFOUNDATION_H @_HAVE_COREFOUNDATION_COREFOUNDATION_H@

#ifdef HAVE_ENDIAN_H
#define _DEFAULT_SOURCE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this macro and why is it necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is needed to since glib 2.19, otherwise we get a implicit declaration function

(Sorry I did not get any notification of this...)

@@ -1,4 +1,6 @@
set(EXAMPLES-SOURCES
felica-lite-dump
felica-read-ndef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace is different for these lines compared to other lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

ribalda and others added 4 commits April 15, 2020 15:24
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants