Summary: | ASTERISK-01559: Compiler warning in astman.c | ||
Reporter: | khb (khb) | Labels: | |
Date Opened: | 2004-05-07 18:13:31 | Date Closed: | 2008-01-15 14:54:10.000-0600 |
Priority: | Trivial | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) patch_astman_3.txt | |
Description: | Rebuiling Asterisk CVS/2004-05-07 under RH9.0 yielded only one compiler warning. It just a trivial pointer conversion warning. No failures involved. Patch for astman.c is attached. | ||
Comments: | By: khb (khb) 2004-05-07 20:18:16 libnewt RH9 version: newt-0.51.4-1 # gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) By: Brian West (bkw918) 2004-05-07 20:23:44 Reading specs from /usr/lib/gcc-lib/i486-pc-linux-gnu/3.3.2/specs Configured with: /var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/configure --prefix=/usr --bindir=/usr/i486-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i486-pc-linux-gnu/3.3.2/include --datadir=/usr/share/gcc-data/i486-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i486-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i486-pc-linux-gnu/3.3/info --enable-shared --host=i486-pc-linux-gnu --target=i486-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77,objc --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i486-pc-linux-gnu/3.3.2/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --disable-multilib Thread model: posix gcc version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7) By: khb (khb) 2004-05-07 21:52:35 Hmm, run "make test.o" on the attached file, please. Seems to me that a properly type-cast argument to a funtion should not cause a compiler warning. Either your gcc has a problem or we are using different versions of newt. As far as I can tell, my newt.h is identical to most recent version. By: khb (khb) 2004-05-07 22:00:46 newtEntry in newt-051.4 is: newtComponent newtEntry(int left, int top, const char * initialValue, int width, const char ** resultPtr, int flags); I suspect that you have an old version of newt or that newt has slightly different implementation as RH9 edited on: 05-07-04 20:59 By: Brian West (bkw918) 2004-05-07 22:20:06 asterisk root # cc -c -o test.o test.c test.c: In function `test2': test.c:25: warning: passing arg 5 of `newtEntry' from incompatible pointer type test.c: In function `test3': test.c:33: warning: passing arg 5 of `newtEntry' from incompatible pointer type asterisk root # locate libnewt /usr/lib/libnewt.so.0.50.35 /usr/lib/libnewt.so /usr/lib/libnewt.a /usr/lib/libnewt.so.0.50 By: Brian West (bkw918) 2004-05-07 22:21:17 This is a fresh gentoo install all up to date.... that is the latest libnewt in portage. By: Brian West (bkw918) 2004-05-07 22:23:20 newt-0.50.35-r2.ebuild By: Brian West (bkw918) 2004-05-07 22:28:33 ACK newt is a redhat creation... EVIL By: khb (khb) 2004-05-07 22:52:36 Debian newt is identical to RH latest newt is 0.51-6 perhaps gentoo should be more like "me too" :-) edited on: 05-07-04 21:52 By: Brian West (bkw918) 2004-05-08 00:06:35 using 0.51-6 gives the same results on a diffrent box: root@asterisk:~# cc -c -o test.o test.c test.c: In function `test2': test.c:25: warning: passing arg 5 of `newtEntry' from incompatible pointer type test.c: In function `test3': test.c:33: warning: passing arg 5 of `newtEntry' from incompatible pointer type root@asterisk:~# gcc -v Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/specs gcc version 2.95.3 20010315 (release) By: Brian West (bkw918) 2004-05-08 00:19:40 newt-0.50.35 works fine. Newer versions seem to have this darn bug. Now the question is what is the proper fix :P bkw By: khb (khb) 2004-05-08 00:56:18 test.c is just a compiler test, it does not test your newt. you need to look at /usr/include/newt.h at the declaration of newtComponent newtEntry(int left, int top, const char * initialValue, int width, const char ** resultPtr, int flags); ^^^^^^^^^^^^^^^^^^^^^^^^ Astman seems to work alright. I think the patch above is the right one for RH/Debian or any other newer newt edited on: 05-08-04 01:47 By: khb (khb) 2004-05-08 03:25:57 Ok, I checked it out, arg 5 was changed to a CONST char** sometime after v. 0.51.0 so either we do type cast in the argument list, or change the declaration of the items to const *variable; see alternate patch attached, astman_patch2.txt By: Brian West (bkw918) 2004-05-08 11:53:17 guess I could manually upgrade :P and we could just list the version requirements. By: Brian West (bkw918) 2004-05-08 11:55:12 Lets just do the first patch and list 51.6 or higher as the version you need of newt? By: khb (khb) 2004-05-08 13:07:35 If you want to list a version requirement, the second patch would be cleaner, but without the #ifdef and #define. Why do a type cast to CONST if we can declare the pointers correctly as const char * in the first place. Version can be announced as 0.51.4 new patch attached By: Brian West (bkw918) 2004-05-08 13:40:37 I like going the clean way :) bkw By: Mark Spencer (markster) 2004-05-08 16:32:05 Fixed in CVS By: Digium Subversion (svnbot) 2008-01-15 14:54:10.000-0600 Repository: asterisk Revision: 2926 U trunk/astman/astman.c U trunk/utils/astman.c ------------------------------------------------------------------------ r2926 | markster | 2008-01-15 14:54:09 -0600 (Tue, 15 Jan 2008) | 2 lines Update default astman types for newer newt (bug ASTERISK-1559) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=2926 |