-
Notifications
You must be signed in to change notification settings - Fork 205
Fix assertion related compile failure #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Conversation
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
static_assert is declared in assert.h and should only be used after c11.
@wdhongtw
wdhongtw
force-pushed
the
release3_1_apl
branch
from
March 29, 2018 10:42
ddefc06 to
a9d0187
Compare
Author
wdhongtw
commented
Mar 29, 2018
When build this tool with generate_build_files.sh and ./configure and make install,
we may see some compile failure like
gcc -DHAVE_CONFIG_H -I. -Wall -Wshadow -fno-builtin -Wextra -Wsign-compare -Wformat=2 -Wno-format-nonliteral -Wno-unused-parameter -Wno-unused-function -std=c99 -DREGRESSION_TEST=1 -DSECONDARY_DJW=1 -DSECONDARY_FGK=1 -DXD3_MAIN=1 -DXD3_DEBUG=0 -g -O2 -MT xdelta3-xdelta3.o -MD -MP -MF .deps/xdelta3-xdelta3.Tpo -c -o xdelta3-xdelta3.o `test -f 'xdelta3.c' || echo './'`xdelta3.c
In file included from xdelta3.h:30:0,
from xdelta3.c:264:
config.h:65:23: error: expected declaration specifiers or ‘...’ before numeric constant
#define SIZEOF_SIZE_T 8
^
xdelta3.h:171:15: note: in expansion of macro ‘SIZEOF_SIZE_T’
static_assert(SIZEOF_SIZE_T == sizeof(size_t), "SIZEOF_SIZE_T not correctly set");
^
In file included from xdelta3.c:264:0:
xdelta3.h:171:48: error: expected declaration specifiers or ‘...’ before string constant
static_assert(SIZEOF_SIZE_T == sizeof(size_t), "SIZEOF_SIZE_T not correctly set");
^
I guess this compile do fail because compiler think that statement is a function declaration..
So compiler says that specifiers should be added.
Fix this bug by including assert.h. Also change C standard from C99 to C11, because static_assert
is added since C11.
This was referenced Mar 1, 2019
laqieer
added a commit
to laqieer/FEHR
that referenced
this pull request
Feb 28, 2020
jmacd/xdelta#241 Signed-off-by: laqieer <laqieer@126.com>
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.
static_assertis declared inassert.hand should only be used after C11.