Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
wdhongtw wants to merge 1 commit into jmacd:release3_1_apl
base: release3_1_apl
Choose a base branch
Loading
from wdhongtw:release3_1_apl

Conversation

@wdhongtw
Copy link

@wdhongtw wdhongtw commented Mar 29, 2018

static_assert is declared in assert.h and should only be used after C11.

pleonex reacted with thumbs up emoji
static_assert is declared in assert.h and should only be used after c11.
Copy link
Author

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.

laqieer added a commit to laqieer/FEHR that referenced this pull request Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /