Re: svn commit: r300557 - head/usr.sbin/apmd
On Thu, 26 May 2016, Jilles Tjoelker wrote: On Tue, May 24, 2016 at 08:52:32AM -0700, John Baldwin wrote: On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: On Mon, May 23, 2016 at 9:15 PM, Peter Wemm wrote: Author: peter Date: Tue May 24 03:15:46 2016 New Revision: 300557 URL: https://svnweb.freebsd.org/changeset/base/300557 Log: It seems is a new prerequisite for after r300539. Attempt to fix the build for i386. Modified: head/usr.sbin/apmd/apmd.c head/usr.sbin/apmd/apmdlex.l head/usr.sbin/apmd/apmdparse.y Are you sure this is necessary, even after 300544? Actually, we try to avoid nested includes when possible for userland, so I'd be inclined to drop the nested include and just add to the places that need it. Userland code in the base system is supposed to have or as the first #include anyway (which apmd was not following), so any fixes to userland are probably style fixes anyway. This is traditional BSD convention, but headers specified by POSIX work differently. POSIX headers can be included alone, so files that only include POSIX headers rarely need #include . This often causes some ugliness in the header file to use hidden names for things to reduce namespace pollution. Since is not specified by POSIX, it is not required to work without prerequisites. However, its man page always documented that it has no prequisites. Except, its man page has a cryptic reference to malloc(3). This used to mean "bit_alloc() allocates storage using calloc(), but we're not telling you this detail, or that you must include to get calloc() declared iff you use bit_alloc(). It now means "bit_alloc(), allocates storage using calloc(), but we're not telling you this detail, or that we now include as undocumented namespace pollution since this is the quickest fix for namespace problems caused by changing the implementation of bit_alloc() from a macro to an inline function". sys/bitstring.h has the following old namespace problems: - use of calloc(), and intentionally keeping itself "clean" by not declaring this. This was a smaller problem when bit_alloc() was a macro. and the following new namespace problems: - use of ffsl(), and intentionally keeping itself "clean" by not declaring this. Just declaring this should work. If ffsl() is not translated by the compiler to __builtin_ffsl(), too bad. - use of __bitcountl(), and intentionally keeping itself "clean" by not declaring this. The builtin is spelled __builtin_popcountl() but we wrap this to our spelling. The underscores might prevent translation to the builtin (probably only with strict compiler flags) and the spelling change certainly prevent it. This is technically better than polluting the application namespace like using ffsl() does, and the spelling change gives us more control (which we use to provide 50 lines of compatibility cruft), but it means that just declaring the function won't work. It is only defined in . Thus gives as a new prerequisite and thus mostly defeats the otherwise mostly careful-to-a-fault anti-pollution measures in :-(. sys/bitstring.h uses unsigned long instead of a possibly-better type like __uregister_t or __uintmax_t partly to avoid pollution. - undocumented include of as a quick fix for the previous problem. Plain bitstring.h has the following new namespace pollutions: - undocumented include of as a quick fix for the calloc() problem - undocumented include of as a quick fix for the ffsl() problem These headers are too careful about pollution to include , so they don't accidentally define __bitcountl(). Bruce ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r300557 - head/usr.sbin/apmd
On Thursday, May 26, 2016 07:54:20 PM Jilles Tjoelker wrote: > On Tue, May 24, 2016 at 08:52:32AM -0700, John Baldwin wrote: > > On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: > > > On Mon, May 23, 2016 at 9:15 PM, Peter Wemm wrote: > > > > Author: peter > > > > Date: Tue May 24 03:15:46 2016 > > > > New Revision: 300557 > > > > URL: https://svnweb.freebsd.org/changeset/base/300557 > > > > > > > > Log: > > > > It seems is a new prerequisite for after > > > > r300539. Attempt to fix the build for i386. > > > > > > > > Modified: > > > > head/usr.sbin/apmd/apmd.c > > > > head/usr.sbin/apmd/apmdlex.l > > > > head/usr.sbin/apmd/apmdparse.y > > > > > > Are you sure this is necessary, even after 300544? > > > > Actually, we try to avoid nested includes when possible for userland, > > so I'd be inclined to drop the nested include and just > > add to the places that need it. Userland code in the > > base system is supposed to have or as the > > first #include anyway (which apmd was not following), so any fixes to > > userland are probably style fixes anyway. > > This is traditional BSD convention, but headers specified by POSIX work > differently. POSIX headers can be included alone, so files that only > include POSIX headers rarely need #include . This often > causes some ugliness in the header file to use hidden names for things > to reduce namespace pollution. > > Since is not specified by POSIX, it is not required to > work without prerequisites. FWIW I have no investment in the commit I made - I needed it to compile for the cluster. Feel free to change/revert my commit so long as world compiles. -- Peter Wemm - pe...@wemm.org; pe...@freebsd.org; pe...@yahoo-inc.com; KI6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 signature.asc Description: This is a digitally signed message part.
Re: svn commit: r300557 - head/usr.sbin/apmd
On Tue, May 24, 2016 at 08:52:32AM -0700, John Baldwin wrote: > On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: > > On Mon, May 23, 2016 at 9:15 PM, Peter Wemm wrote: > > > Author: peter > > > Date: Tue May 24 03:15:46 2016 > > > New Revision: 300557 > > > URL: https://svnweb.freebsd.org/changeset/base/300557 > > > Log: > > > It seems is a new prerequisite for after > > > r300539. Attempt to fix the build for i386. > > > Modified: > > > head/usr.sbin/apmd/apmd.c > > > head/usr.sbin/apmd/apmdlex.l > > > head/usr.sbin/apmd/apmdparse.y > > Are you sure this is necessary, even after 300544? > Actually, we try to avoid nested includes when possible for userland, > so I'd be inclined to drop the nested include and just > add to the places that need it. Userland code in the > base system is supposed to have or as the > first #include anyway (which apmd was not following), so any fixes to > userland are probably style fixes anyway. This is traditional BSD convention, but headers specified by POSIX work differently. POSIX headers can be included alone, so files that only include POSIX headers rarely need #include . This often causes some ugliness in the header file to use hidden names for things to reduce namespace pollution. Since is not specified by POSIX, it is not required to work without prerequisites. -- Jilles Tjoelker ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r300557 - head/usr.sbin/apmd
On Monday, May 23, 2016 09:24:41 PM Alan Somers wrote: > On Mon, May 23, 2016 at 9:15 PM, Peter Wemm wrote: > > > Author: peter > > Date: Tue May 24 03:15:46 2016 > > New Revision: 300557 > > URL: https://svnweb.freebsd.org/changeset/base/300557 > > > > Log: > > It seems is a new prerequisite for after > > r300539. Attempt to fix the build for i386. > > > > Modified: > > head/usr.sbin/apmd/apmd.c > > head/usr.sbin/apmd/apmdlex.l > > head/usr.sbin/apmd/apmdparse.y > > > > > Are you sure this is necessary, even after 300544? Actually, we try to avoid nested includes when possible for userland, so I'd be inclined to drop the nested include and just add to the places that need it. Userland code in the base system is supposed to have or as the first #include anyway (which apmd was not following), so any fixes to userland are probably style fixes anyway. -- John Baldwin ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r300557 - head/usr.sbin/apmd
On Mon, May 23, 2016 at 9:15 PM, Peter Wemm wrote: > Author: peter > Date: Tue May 24 03:15:46 2016 > New Revision: 300557 > URL: https://svnweb.freebsd.org/changeset/base/300557 > > Log: > It seems is a new prerequisite for after > r300539. Attempt to fix the build for i386. > > Modified: > head/usr.sbin/apmd/apmd.c > head/usr.sbin/apmd/apmdlex.l > head/usr.sbin/apmd/apmdparse.y > > Are you sure this is necessary, even after 300544? ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r300557 - head/usr.sbin/apmd
Author: peter Date: Tue May 24 03:15:46 2016 New Revision: 300557 URL: https://svnweb.freebsd.org/changeset/base/300557 Log: It seems is a new prerequisite for after r300539. Attempt to fix the build for i386. Modified: head/usr.sbin/apmd/apmd.c head/usr.sbin/apmd/apmdlex.l head/usr.sbin/apmd/apmdparse.y Modified: head/usr.sbin/apmd/apmd.c == --- head/usr.sbin/apmd/apmd.c Tue May 24 03:13:27 2016(r300556) +++ head/usr.sbin/apmd/apmd.c Tue May 24 03:15:46 2016(r300557) @@ -32,6 +32,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include #include #include #include @@ -45,7 +46,6 @@ static const char rcsid[] = #include #include #include -#include #include #include #include Modified: head/usr.sbin/apmd/apmdlex.l == --- head/usr.sbin/apmd/apmdlex.lTue May 24 03:13:27 2016 (r300556) +++ head/usr.sbin/apmd/apmdlex.lTue May 24 03:15:46 2016 (r300557) @@ -30,6 +30,7 @@ * $FreeBSD$ */ +#include #include #include #include Modified: head/usr.sbin/apmd/apmdparse.y == --- head/usr.sbin/apmd/apmdparse.y Tue May 24 03:13:27 2016 (r300556) +++ head/usr.sbin/apmd/apmdparse.y Tue May 24 03:15:46 2016 (r300557) @@ -30,6 +30,7 @@ * $FreeBSD$ */ +#include #include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"