Bug 32696 - TWM: menus.c:2374: warning: implicit declaration of function ‘putenv’
Summary: TWM: menus.c:2374: warning: implicit declaration of function ‘putenv’
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/twm (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-28 01:59 UTC by Dan Wallis
Modified: 2011-11-13 17:52 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Dan Wallis 2010-12-28 01:59:40 UTC
When attempting to install twm version 1.0.5 on my Gentoo system, the build threw a quality-assurance warning:

 * menus.c:2374: warning: implicit declaration of function ‘putenv’

Same thing at line 2382. I'm not sure how to solve this yet, but perhaps something similar to lines 775-837 in util.c could be used? Duplication of that code probably won't be best though, so I recommend someone who knows what they're doing takes a look. :)
Comment 1 Dan Wallis 2011-02-13 02:21:34 UTC
Still a problem in version 1.0.6.
Comment 2 Alan Coopersmith 2011-05-09 22:42:03 UTC
Can't we just add #include <stdlib.h> to get the standard prototype for putenv()?
Comment 3 Alan Coopersmith 2011-05-09 23:00:22 UTC
Actually, that shouldn't be needed - menus.c includes twm.h which includes
<stdlib.h>, so it should be included already.

It does appear glibc guards the definition with several #ifdefs, so someone
who knows more about Linux header definitions will need to work out if this
needs AC_SYSTEM_EXTENSIONS or something more specific.
Comment 4 Julien Cristau 2011-05-10 14:16:46 UTC
> --- Comment #3 from Alan Coopersmith <alan.coopersmith@oracle.com> 2011-05-09 23:00:22 PDT ---
> Actually, that shouldn't be needed - menus.c includes twm.h which includes
> <stdlib.h>, so it should be included already.
> 
> It does appear glibc guards the definition with several #ifdefs, so someone
> who knows more about Linux header definitions will need to work out if this
> needs AC_SYSTEM_EXTENSIONS or something more specific.
> 
putenv is guarded by #if defined __USE_SVID || defined __USE_XOPEN in my
copy.  AC_USE_SYSTEM_EXTENSIONS sets _GNU_SOURCE, which turns on pretty
much everything (in particular _XOPEN_SOURCE and _SVID_SOURCE, which in
turn enable the above two), so that should work fine.
Comment 5 Alan Coopersmith 2011-05-10 15:49:44 UTC
Fired up a VirtualBox image of Fedora 14, and tested, and these changes
worked for me:

http://patchwork.freedesktop.org/patch/5411/
Comment 6 Alan Coopersmith 2011-05-11 20:35:26 UTC
Fix pushed to git master:
http://cgit.freedesktop.org/xorg/app/twm/commit/?id=0f1ccd0b3409ab9b9fce1256fc59ad9bbe69a349


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.