The last patch fixed some of the warnings. The rest I’m seeing from clang are simple stuff:
warning: using the result of an assignment as a condition without parentheses [-Wparentheses] aka assignments in for loops & if/while statements should be wrapped in parens warning: '&&' within '||' [-Wlogical-op-parentheses], so added paren wraps switch statement not handling all enumerations, so added default: break;
Note: this is only for sources used by libpd.
Here’s a patch:
On Mar 22, 2016, at 10:39 AM, Miller Puckette <msp@ucsd.edu mailto:msp@ucsd.edu> wrote:
It's already in and up - check away :)
M On Tue, Mar 22, 2016 at 10:37:20AM -0600, Dan Wilcox wrote:
Sweet. clang on OSX gives me about 100+ warnings when building the pure-data sources for libpd, most of which involve simple things like suggested paren wraps, “implicit conversion loses integer precision,” etc. These might be related to what iOhannes is seeing. I’ll wait to see if this bugfix work is accepted and then I can make a similar patch for the warnings.
Dan Wilcox @danomatika <https://twitter.com/danomatika https://twitter.com/danomatika> danomatika.com http://danomatika.com/ <http://danomatika.com/ http://danomatika.com/> robotcowboy.com http://robotcowboy.com/ <http://robotcowboy.com/ http://robotcowboy.com/>
On Mar 22, 2016, at 5:00 AM, pd-dev-request@lists.iem.at mailto:pd-dev-request@lists.iem.at wrote:
From: IOhannes m zmölnig <zmoelnig@iem.at mailto:zmoelnig@iem.at <mailto:zmoelnig@iem.at mailto:zmoelnig@iem.at>> Subject: Re: [PD-dev] Memory leaks? Date: March 21, 2016 at 3:29:25 PM MDT To: pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at <mailto:pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at>
On 03/21/2016 09:51 PM, Miller Puckette wrote:
Yep, thanks. Fixing it now...
since you seem to be in bug-squashing mode: there are about 100 more bugs waiting to be fixed :-)
-------- Dan Wilcox @danomatika https://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
Whoops. Missed a couple spots. Also, forgot to mention I added #include <stdlib.h> to m_pd.h to silence "warning: implicitly declaring library function 'alloca' with type 'void *(unsigned long)’” in x_array, x_list, etc.
Here’s a new patch. Disregard the first one.
-------- Dan Wilcox @danomatika https://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
On Mar 24, 2016, at 9:27 PM, Dan Wilcox danomatika@gmail.com wrote:
The last patch fixed some of the warnings. The rest I’m seeing from clang are simple stuff:
warning: using the result of an assignment as a condition without parentheses [-Wparentheses] aka assignments in for loops & if/while statements should be wrapped in parens
warning: '&&' within '||' [-Wlogical-op-parentheses], so added paren wraps
switch statement not handling all enumerations, so added default: break;
Note: this is only for sources used by libpd.
Here’s a patch:
<warning_fixes.patch>
On Mar 22, 2016, at 10:39 AM, Miller Puckette <msp@ucsd.edu mailto:msp@ucsd.edu> wrote:
It's already in and up - check away :)
M On Tue, Mar 22, 2016 at 10:37:20AM -0600, Dan Wilcox wrote:
Sweet. clang on OSX gives me about 100+ warnings when building the pure-data sources for libpd, most of which involve simple things like suggested paren wraps, “implicit conversion loses integer precision,” etc. These might be related to what iOhannes is seeing. I’ll wait to see if this bugfix work is accepted and then I can make a similar patch for the warnings.
Dan Wilcox @danomatika <https://twitter.com/danomatika https://twitter.com/danomatika> danomatika.com http://danomatika.com/ <http://danomatika.com/ http://danomatika.com/> robotcowboy.com http://robotcowboy.com/ <http://robotcowboy.com/ http://robotcowboy.com/>
On Mar 22, 2016, at 5:00 AM, pd-dev-request@lists.iem.at mailto:pd-dev-request@lists.iem.at wrote:
From: IOhannes m zmölnig <zmoelnig@iem.at mailto:zmoelnig@iem.at <mailto:zmoelnig@iem.at mailto:zmoelnig@iem.at>> Subject: Re: [PD-dev] Memory leaks? Date: March 21, 2016 at 3:29:25 PM MDT To: pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at <mailto:pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at>
On 03/21/2016 09:51 PM, Miller Puckette wrote:
Yep, thanks. Fixing it now...
since you seem to be in bug-squashing mode: there are about 100 more bugs waiting to be fixed :-)
Dan Wilcox @danomatika https://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
Sorry, missed this last... if it's needed I'd prefer to add stdlib.h to all the files where alloca gets used (so as not to include any more than necessary in m_pd.h).
cheers M
On Thu, Mar 24, 2016 at 09:37:33PM -0600, Dan Wilcox wrote:
Whoops. Missed a couple spots. Also, forgot to mention I added #include <stdlib.h> to m_pd.h to silence "warning: implicitly declaring library function 'alloca' with type 'void *(unsigned long)’” in x_array, x_list, etc.
Here’s a new patch. Disregard the first one.
clang is pretty strict by default and I generally try to fix any warnings it finds, as opposed to overriding them. If you think the requested changes aren’t needed, I’ll go that route. My thought was to lessen the angst for beginners compiling libpd & being put off by a wall of warnings (especially in ofxPd).
I realized I can fix the alloc warning by adding HAVE_ALLOCA_H to the libpd Makefile, so the stdlib.h include is unnecessary. Furthermore, Maybe this define would be unnecessary by using better compile-time system detection. For example, from d_fft_fftsg.c:
#ifdef HAVE_ALLOCA_H /* ifdef nonsense to find include for alloca() */ # include <alloca.h> /* linux, mac, mingw, cygwin */ #elif defined _MSC_VER # include <malloc.h> /* MSVC */ #else # include <stddef.h> /* BSDs for example */ #endif /* end alloca() ifdef nonsense */
Could be:
#ifdef _MSC_VER #include <malloc.h> /* MSVC */ #elif defined(__linux__) || defined(__APPLE__) || defined(_WIN32) #include <alloca.h> /* linux, mac, mingw, cygwin */ #else #include <stddef.h> /* BSDs for example */ #endif
I just tried and it compiles said file without the warning on OSX.
References: * http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-i... http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor * https://sourceforge.net/p/predef/wiki/OperatingSystems/ https://sourceforge.net/p/predef/wiki/OperatingSystems/
-------- Dan Wilcox @danomatika https://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
On Mar 24, 2016, at 10:03 PM, Miller Puckette msp@ucsd.edu wrote:
Sorry, missed this last... if it's needed I'd prefer to add stdlib.h to all the files where alloca gets used (so as not to include any more than necessary in m_pd.h).
cheers M
On Thu, Mar 24, 2016 at 09:37:33PM -0600, Dan Wilcox wrote:
Whoops. Missed a couple spots. Also, forgot to mention I added #include <stdlib.h> to m_pd.h to silence "warning: implicitly declaring library function 'alloca' with type 'void *(unsigned long)’” in x_array, x_list, etc.
Here’s a new patch. Disregard the first one.
hi dan, list.
i have some patches i've been meaning to submit relating to the alloca.h ifdef hell.
i'm a FreeBSD user and the stddef.h else clause is wrong and actually gets patched out downstream. Free/Net/Open and DragonFly BSD all have alloca() in stdlib.h.
i'll can review my patches now and upload them but they retain the old style, not your proposed changes.
cheers, t.
On 03/26/16 04:36, Dan Wilcox wrote:
clang is pretty strict by default and I generally try to fix any warnings it finds, as opposed to overriding them. If you think the requested changes aren’t needed, I’ll go that route. My thought was to lessen the angst for beginners compiling libpd & being put off by a wall of warnings (especially in ofxPd).
I realized I can fix the alloc warning by adding HAVE_ALLOCA_H to the libpd Makefile, so the stdlib.h include is unnecessary. Furthermore, Maybe this define would be unnecessary by using better compile-time system detection. For example, from d_fft_fftsg.c:
#ifdef HAVE_ALLOCA_H /* ifdef nonsense to find include for alloca() */ # include <alloca.h> /* linux, mac, mingw, cygwin */ #elif defined _MSC_VER # include <malloc.h> /* MSVC */ #else # include <stddef.h> /* BSDs for example */ #endif /* end alloca() ifdef nonsense */
Could be:
#ifdef _MSC_VER #include <malloc.h> /* MSVC */ #elif defined(__linux__) || defined(__APPLE__) || defined(_WIN32) #include <alloca.h> /* linux, mac, mingw, cygwin */ #else #include <stddef.h> /* BSDs for example */ #endif
I just tried and it compiles said file without the warning on OSX.
References:
http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-i...
Dan Wilcox @danomatika https://twitter.com/danomatika danomatika.com http://danomatika.com robotcowboy.com http://robotcowboy.com
On Mar 24, 2016, at 10:03 PM, Miller Puckette <msp@ucsd.edu mailto:msp@ucsd.edu> wrote:
Sorry, missed this last... if it's needed I'd prefer to add stdlib.h to all the files where alloca gets used (so as not to include any more than necessary in m_pd.h).
cheers M
On Thu, Mar 24, 2016 at 09:37:33PM -0600, Dan Wilcox wrote:
Whoops. Missed a couple spots. Also, forgot to mention I added #include <stdlib.h> to m_pd.h to silence "warning: implicitly declaring library function 'alloca' with type 'void *(unsigned long)’” in x_array, x_list, etc.
Here’s a new patch. Disregard the first one.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
... but isn't it simpler just to set -Wno-logical-op-parentheses etc. when compiling?
I noticed that you also propose adding #include <stdlib.h> to m_pd.h - I don't know why that would be necessary (and I think I should take stdio out of it if that can be done without breaking too much code.
cheers M
On Thu, Mar 24, 2016 at 09:27:18PM -0600, Dan Wilcox wrote:
The last patch fixed some of the warnings. The rest I’m seeing from clang are simple stuff:
warning: using the result of an assignment as a condition without parentheses [-Wparentheses] aka assignments in for loops & if/while statements should be wrapped in parens
warning: '&&' within '||' [-Wlogical-op-parentheses], so added paren wraps
switch statement not handling all enumerations, so added default: break;
Note: this is only for sources used by libpd.
Here’s a patch:
On Mar 22, 2016, at 10:39 AM, Miller Puckette <msp@ucsd.edu mailto:msp@ucsd.edu> wrote:
It's already in and up - check away :)
M On Tue, Mar 22, 2016 at 10:37:20AM -0600, Dan Wilcox wrote:
Sweet. clang on OSX gives me about 100+ warnings when building the pure-data sources for libpd, most of which involve simple things like suggested paren wraps, “implicit conversion loses integer precision,” etc. These might be related to what iOhannes is seeing. I’ll wait to see if this bugfix work is accepted and then I can make a similar patch for the warnings.
Dan Wilcox @danomatika <https://twitter.com/danomatika https://twitter.com/danomatika> danomatika.com http://danomatika.com/ <http://danomatika.com/ http://danomatika.com/> robotcowboy.com http://robotcowboy.com/ <http://robotcowboy.com/ http://robotcowboy.com/>
On Mar 22, 2016, at 5:00 AM, pd-dev-request@lists.iem.at mailto:pd-dev-request@lists.iem.at wrote:
From: IOhannes m zmölnig <zmoelnig@iem.at mailto:zmoelnig@iem.at <mailto:zmoelnig@iem.at mailto:zmoelnig@iem.at>> Subject: Re: [PD-dev] Memory leaks? Date: March 21, 2016 at 3:29:25 PM MDT To: pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at <mailto:pd-dev@lists.iem.at mailto:pd-dev@lists.iem.at>
On 03/21/2016 09:51 PM, Miller Puckette wrote:
Yep, thanks. Fixing it now...
since you seem to be in bug-squashing mode: there are about 100 more bugs waiting to be fixed :-)
Dan Wilcox @danomatika https://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/