Skip to content

mrib.c: don't use cpu_to_be32 outside of function#2

Open
cotequeiroz wants to merge 1 commit intosbyx:masterfrom
cotequeiroz:be32_constant
Open

mrib.c: don't use cpu_to_be32 outside of function#2
cotequeiroz wants to merge 1 commit intosbyx:masterfrom
cotequeiroz:be32_constant

Conversation

@cotequeiroz
Copy link

cpu_to_be32 is not a constant, so it can't be used outside of a function.

Compilation fails on little-endian machines with:

[ 11%] Building C object CMakeFiles/omcproxy.dir/src/mrib.c.o
In file included from /var/lib/buildbot/slaves/slave-lede-builds4/mipsel_74kc/build/sdk/build_dir/target-mipsel_74kc_musl/omcproxy-2017-02-14-1fe6f48f/src/omcproxy.h:51:0,
                 from /var/lib/buildbot/slaves/slave-lede-builds4/mipsel_74kc/build/sdk/build_dir/target-mipsel_74kc_musl/omcproxy-2017-02-14-1fe6f48f/src/mrib.c:39:
/var/lib/buildbot/slaves/slave-lede-builds4/mipsel_74kc/build/sdk/build_dir/target-mipsel_74kc_musl/omcproxy-2017-02-14-1fe6f48f/src/mrib.c:57:34: error: braced-group within expression allowed only inside a function
 static uint32_t ipv4_rtr_alert = cpu_to_be32(0x94040000);
                                  ^

Linux kernel defines __constant_cpu_to_be32 somewhere, but including its headers was messy. It is used only once, so it is simpler to just spell out the constant.

Signed-off-by: Eneas U de Queiroz cote2004-github@yahoo.com

cpu_to_be32 is not a constant, so it can't be used outside of a
function.

Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.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.

1 participant