• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/libwebsock/0003-fix-incorrect-inline.patch
Yann E. MORINYann E. MORIN committed fd89a8b7d1d22 Aug 2015
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
utf: do not define decode() to be inline
2
​
3
Currently, decode() is prototyped in utf.h, its body is in utf.c and it
4
is called from util.c.
5
​
6
However, decode() is defined to be inline, which can not work since,
7
when compiling util.c, the body of decode() is out-of-scope for that
8
compilation unit.
9
​
10
Furthermore, decode() uses a utf8d, which is a static defined in utf.c .
11
So utf8d is not visible when compiling util.c either.
12
​
13
This means that the definition of decode() along with utf8d is basically
14
wrong, and is now failing with gcc-5.x, with warnings like so:
15
​
16
    libtool: compile:  /home/ymorin/dev/buildroot/O/host/usr/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wmissing-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -c utf.c  -fPIC -DPIC -o .libs/libwebsock_la-utf.o
17
    utf.c:36:12: warning: ‘utf8d’ is static but used in inline function ‘decode’ which is not static
18
       *state = utf8d[256 + *state*16 + type];
19
                ^
20
    utf.c:30:19: warning: ‘utf8d’ is static but used in inline function ‘decode’ which is not static
21
       uint32_t type = utf8d[byte];
22
                       ^
23
    libtool: compile:  /home/ymorin/dev/buildroot/O/host/usr/bin/arm-linux-gcc -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wmissing-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -c util.c  -fPIC -DPIC -o .libs/libwebsock_la-util.o
24
    In file included from websock.h:73:0,
25
                     from util.c:20:
26
    utf.h:25:17: warning: inline function ‘decode’ declared but never defined
27
     uint32_t inline decode(uint32_t *state, uint32_t *codep, uint32_t byte);
28
                     ^
29
​
30
This results in decode() to be omitted from libwebsock.so, and thus link
31
failures when another program wants to link with -lwebsock.
32
​
33
The simplest solution is to not inline decode() at all.
34
​
35
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
36
​
37
---
38
Note: an alternative would be to move both decode() and utf8d into
39
decode.h nad ditch decode.c if decode really must be inline. This is
40
left as an execise for an interested party. But since upstream hasn't
41
seen a single commit in more than a year now... :-(
42
​
43
diff -durN a/src/utf.c b/src/utf.c
44
--- a/src/utf.c 2014-07-15 01:43:20.000000000 +0200
45
+++ b/src/utf.c 2015-08-22 22:29:38.667393786 +0200
46
@@ -24,7 +24,7 @@
47
   1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // s7..s8
48
 };
49
 
50
-uint32_t inline
51
+uint32_t
52
 decode(uint32_t* state, uint32_t* codep, uint32_t byte)
53
 {
54
   uint32_t type = utf8d[byte];
55
diff -durN a/src/utf.h b/src/utf.h
56
--- a/src/utf.h 2014-07-15 01:43:20.000000000 +0200
57
+++ b/src/utf.h 2015-08-22 22:29:10.439227396 +0200
58
@@ -22,7 +22,7 @@
59
 
60
 #include <stdint.h>
61
 
62
-uint32_t inline decode(uint32_t *state, uint32_t *codep, uint32_t byte);
63
+uint32_t decode(uint32_t *state, uint32_t *codep, uint32_t byte);
64
 
65
 
66
 #endif /* UTF_H_ */
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.