Skip to content

add missing return types to main() - #85

Merged
DerDakon merged 1 commit into
masterfrom
missing-main-return
Dec 26, 2019
Merged

DerDakon merged 1 commit into
masterfrom
missing-main-return

Conversation

@DerDakon

Copy link
Copy Markdown
Member

No description provided.

@alanpost

Copy link
Copy Markdown
Contributor

A similar treatment (adding explicit void to main) should be given to the following files:

trylsock.c
tryrsolv.c
trysyslog.c

@DerDakon

Copy link
Copy Markdown
Member Author

good catch, no idea why I did not spot them.

@alanpost alanpost added this to the 1.08 milestone Aug 25, 2019
@DerDakon
DerDakon force-pushed the missing-main-return branch from d4511a8 to 92f7884 Compare August 25, 2019 18:34
Comment thread trysyslog.c Resolved
@DerDakon
DerDakon force-pushed the missing-main-return branch from 92f7884 to 9ff954f Compare August 31, 2019 06:19
@DerDakon
DerDakon requested a review from alanpost September 3, 2019 16:12
@DerDakon
DerDakon force-pushed the missing-main-return branch from 9ff954f to 65ab0e3 Compare September 3, 2019 16:13
Comment thread trysyslog.c Resolved
@DerDakon

DerDakon commented Sep 3, 2019

Copy link
Copy Markdown
Member Author

The point is: main() is void everywhere, because it does not return and the return code comes from _exit(). I avoid _exit() here to not drag in more headers for no reasons, and just make it int main() and return 0;.

@alanpost

alanpost commented Sep 3, 2019

Copy link
Copy Markdown
Contributor

The point is: main() is void everywhere, because it does not return and the return code comes from _exit(). I avoid _exit() here to not drag in more headers for no reasons, and just make it int main() and return 0;.

Nowhere in the codebase does it return from main. Everywhere it calls _exit. We should preserve that behavior.

@DerDakon
DerDakon force-pushed the missing-main-return branch from 65ab0e3 to 62afa31 Compare September 3, 2019 21:17
@DerDakon
DerDakon requested a review from schmonz September 4, 2019 15:17
@DerDakon

DerDakon commented Sep 9, 2019

Copy link
Copy Markdown
Member Author

Btw, Clang now issues these warnings:

qmail-qmqpc.c:138:1: warning: return type of 'main' is not 'int'

@DerDakon
DerDakon force-pushed the missing-main-return branch from 62afa31 to 0d36c26 Compare November 3, 2019 09:39
@DerDakon

DerDakon commented Nov 3, 2019

Copy link
Copy Markdown
Member Author

I'm back to "int main()" now. Fixing one warning with another does not help, and the consistency doesn't give us anything, especially as it's only about try*.c where noone needs to look on any bigger API or structure.

@DerDakon DerDakon modified the milestones: 1.09, 1.08 Nov 18, 2019

@schmonz schmonz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a CHANGES entry. (Good time to refresh ourselves on our criteria for pull requests.)

@DerDakon
DerDakon force-pushed the missing-main-return branch from 0d36c26 to cd8193f Compare December 26, 2019 21:37
@DerDakon
DerDakon merged commit cd8193f into master Dec 26, 2019
@DerDakon
DerDakon deleted the missing-main-return branch December 26, 2019 21:54
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.

4 participants