Skip to content
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

[IMPROVEMENT] Add noreturn attribute to fatal #1179

Merged
merged 2 commits into from Jan 23, 2020
Merged

Conversation

@NilsIrl
Copy link
Contributor

NilsIrl commented Jan 13, 2020

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

My familiarity with the project is as follows (check one):

  • I have used CCExtractor just a couple of times.

Removes the following warnings:

52a52,55
> /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/asf_functions.c: In function ‘asf_readval’:
> /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/asf_functions.c:39:9: warning: ‘rval’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   return rval;
>          ^~~~
1652a1656,1663
> /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/general_loop.c: In function ‘process_data’:
> /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/general_loop.c:741:5: warning: ‘got’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   if (got > data_node->len)
>      ^
> /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/general_loop.c: In function ‘general_loop’:
> /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/general_loop.c:896:9: warning: ‘get_more_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    ret = get_more_data(ctx, &datalist);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -250,7 +250,7 @@ int myth_loop(struct lib_ccx_ctx *ctx);
int matroska_loop(struct lib_ccx_ctx *ctx);

// utility.c
void fatal(int exit_code, const char *fmt, ...);
void fatal(int exit_code, const char *fmt, ...) __attribute__ ((noreturn));

This comment has been minimized.

Copy link
@cfsmp3

cfsmp3 Jan 13, 2020

Contributor

That's not portable - remember, we're not just using GCC, we also use Visual Studio for the Windows builds!

This comment has been minimized.

Copy link
@NilsIrl

NilsIrl Jan 13, 2020

Author Contributor

I was internally dreaming MSVC had the same extension.

Would you be okay with some pre processor stuff to use the equivalent MSVC extenison?

https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2012/dabb5z75(v=vs.110)?redirectedfrom=MSDN

This comment has been minimized.

Copy link
@NilsIrl

NilsIrl Jan 13, 2020

Author Contributor

There also _Noreturn which is in the C11 standard

@ccextractor-bot

This comment has been minimized.

Copy link
Collaborator

ccextractor-bot commented Jan 13, 2020

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results:

Report Name Tests Passed
Broken 12/13
DVB 4/7
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Teletext 14/21
WTV 13/13
XDS 32/34
CEA-708 14/14
DVD 3/3
Options 80/86

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Your PR breaks these cases:


Check the result page for more info.
NilsIrl added 2 commits Jan 14, 2020
@NilsIrl NilsIrl force-pushed the NilsIrl:warning_1 branch from 49d6526 to dc42615 Jan 14, 2020
@cfsmp3

This comment has been minimized.

Copy link
Contributor

cfsmp3 commented Jan 15, 2020

This is still not portable, just adds support to more compilers :-)

@ccextractor-bot

This comment has been minimized.

Copy link
Collaborator

ccextractor-bot commented Jan 15, 2020

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results:

Report Name Tests Passed
Broken 12/13
DVB 4/7
DVR-MS 2/2
General 27/27
Hauppage 3/3
MP4 3/3
NoCC 10/10
Teletext 21/21
WTV 13/13
XDS 33/34
CEA-708 14/14
DVD 3/3
Options 84/86

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Your PR breaks these cases:


Check the result page for more info.
@NilsIrl

This comment has been minimized.

Copy link
Contributor Author

NilsIrl commented Jan 15, 2020

This is still not portable, just adds support to more compilers :-)

Well, because they're behind #if-s, it will build on any compilers but they will have more warnings.

And even if we used C11 (stdnoreturn.h) it wouldn't make it portable to older compilers and most importantly MSVC doesn't even support that.

@NilsIrl

This comment has been minimized.

Copy link
Contributor Author

NilsIrl commented Jan 15, 2020

It might actually be better if a NORETURN (or a similar identifier) was declared because fatal isn't the only place where a warning is emitted because of this.

Another place is ccx_common_structs.h:15.

@kdrag0n kdrag0n mentioned this pull request Jan 21, 2020
7 of 7 tasks complete
@kdrag0n

This comment has been minimized.

Copy link
Contributor

kdrag0n commented Jan 22, 2020

@cfsmp3 Any updates regarding this issue? The attribute may not be that portable, but there is no functional change without them. I think it's safe to say that someone using an exotic compiler can deal with a couple extra warnings — it's certainly no worse than before, even on unsupported compilers.

This would also reduce the number of changes in #1204 and #1205, making them cleaner and less intrusive.

@cfsmp3 cfsmp3 merged commit 60773bb into CCExtractor:master Jan 23, 2020
2 of 4 checks passed
2 of 4 checks passed
CI - linux Not all tests completed successfully, please check
Details
CI - windows Not all tests completed successfully, please check
Details
WIP Ready for review
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.