<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>hi dan, list.<br>
<br>
i have some patches i've been meaning to submit relating to the
alloca.h ifdef hell.<br>
<br>
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.<br>
<br>
i'll can review my patches now and upload them but they retain the
old style, not your proposed changes.<br>
<br>
cheers,<br>
t.<br>
</tt><br>
<div class="moz-cite-prefix">On 03/26/16 04:36, Dan Wilcox wrote:<br>
</div>
<blockquote
cite="mid:B69F3532-70D8-4F4C-AD95-A94844AA7B85@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
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).
<div class=""><br class="">
</div>
<div class="">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:</div>
<div class=""><br class="">
</div>
<div class="">#ifdef HAVE_ALLOCA_H /* ifdef nonsense to
find include for alloca() */<br class="">
# include <alloca.h> /* linux, mac, mingw, cygwin
*/<br class="">
#elif defined _MSC_VER<br class="">
# include <malloc.h> /* MSVC */<br class="">
#else<br class="">
# include <stddef.h> /* BSDs for example */<br
class="">
#endif /* end alloca() ifdef nonsense */</div>
<div class=""><br class="">
</div>
<div class="">Could be:</div>
<div class=""><br class="">
</div>
<div class="">#ifdef _MSC_VER</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>#include
<malloc.h> /* MSVC */</div>
<div class="">#elif defined(__linux__) || defined(__APPLE__) ||
defined(_WIN32)</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>#include
<alloca.h> /* linux, mac, mingw, cygwin */</div>
<div class="">#else</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>#include
<stddef.h> /* BSDs for example */</div>
<div class="">#endif</div>
<div class=""><br class="">
</div>
<div class="">I just tried and it compiles said file without the
warning on OSX.</div>
<div class=""><br class="">
</div>
<div class="">References:</div>
<div class="">* <a moz-do-not-send="true"
href="http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor"
class="">http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor</a></div>
<div class="">* <a moz-do-not-send="true"
href="https://sourceforge.net/p/predef/wiki/OperatingSystems/"
class="">https://sourceforge.net/p/predef/wiki/OperatingSystems/</a></div>
<div class=""><br class="">
<div class="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;" class="">--------<br
class="">
Dan Wilcox<br class="">
<a moz-do-not-send="true"
href="https://twitter.com/danomatika" class="">@danomatika</a><br
class="">
<a moz-do-not-send="true" href="http://danomatika.com"
class="">danomatika.com</a><br class="">
<div class=""><a moz-do-not-send="true"
href="http://robotcowboy.com" class="">robotcowboy.com</a></div>
</div>
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Mar 24, 2016, at 10:03 PM, Miller
Puckette <<a moz-do-not-send="true"
href="mailto:msp@ucsd.edu" class="">msp@ucsd.edu</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Sorry, missed this last... if it's needed
I'd prefer to add stdlib.h to all<br class="">
the files where alloca gets used (so as not to include
any more than necessary<br class="">
in m_pd.h).<br class="">
<br class="">
cheers<br class="">
M<br class="">
<br class="">
<br class="">
On Thu, Mar 24, 2016 at 09:37:33PM -0600, Dan Wilcox
wrote:<br class="">
<blockquote type="cite" class="">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.<br class="">
<br class="">
Here’s a new patch. Disregard the first one.<br
class="">
<br class="">
<br class="">
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Pd-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a>
<a class="moz-txt-link-freetext" href="http://lists.puredata.info/listinfo/pd-dev">http://lists.puredata.info/listinfo/pd-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>