bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Fix various compiler warnings


From: Darshit Shah
Subject: Re: [Bug-wget] Fix various compiler warnings
Date: Sat, 22 Nov 2014 17:23:33 +0530
User-agent: Mutt/1.5.23 (2014-03-12)

On 11/22, Tim Rühsen wrote:
Am Samstag, 22. November 2014, 14:52:14 schrieb Darshit Shah:
This is a new set pf patches to eliminate some more compiler warnings.

[PATCH 1/8] Mark unused paramter in utils.c
[PATCH 2/8] Add extern declaration for version.c strings
[PATCH 3/8] Fix missing extern declaration error for build_info.pl
[PATCH 4/8] Declare extern numurls in common header
[PATCH 5/8] Make extern declaration for program_name
[PATCH 6/8] Add extern declaration for program_arsgstring
[PATCH 7/8] Remove defensive assert in cookies.c
[PATCH 8/8] Supplement logical assumption assert with error message

Patches 1 through 6 eliminate compiler warnings. I've tested these patches
in a fresh clone of Wget, and they seem to work without any of the issues
that the patches I sent yesterday were suffering from.

In patch 7, I've eliminated what looked like a purely defensive assert and
added a conditional to check and print an error message. In case the cookie
is not found, Wget can continue working.

In patch 8 however, the assert is for identifying a logical issue in the
code. Hence, I've retained it. And added a call to abort() after the error
messages are printed out.

Patches 7 and 8 are mostly meant to be examples of how we could handle the
various assert statements in the codebase.


Thanks Darshit.

After applying your patch I got:

host.c: In function 'address_list_set_faulty':
host.c:156:7: warning: format '%s' expects argument of type 'char *', but
argument 4 has type 'int' [-Wformat=]
      logprintf (LOG_ALWAYS, "index: %d\nal->faulty: %s\n", index, al-
faulty);

It's abvious:
+      logprintf (LOG_ALWAYS, "index: %d\nal->faulty: %s\n", index, al-
faulty);

Damn! I didn't bother to check the datatype and went on my instinct. Also, my compiler did *not* complain about this.

I need to start setting up my GCC CFLAGS correctly now. Clang has better warning and error messages, but GCC seems to report more issues.

Please feel free to push it after changing the above.
I'll push all till the first 6. I think I'd like to make some changes to the 7th patch. I'll send in a new one once I'm done.

Tim


--- end quoted text ---

--
Thanking You,
Darshit Shah

Attachment: pgppcdWb3TrLx.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]