From owner-svn-src-stable-9@FreeBSD.ORG Fri Dec 13 18:24:36 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EBE6BE1; Fri, 13 Dec 2013 18:24:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D6A261047; Fri, 13 Dec 2013 18:24:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBDIOax6063709; Fri, 13 Dec 2013 18:24:36 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBDIOabU063708; Fri, 13 Dec 2013 18:24:36 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312131824.rBDIOabU063708@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 13 Dec 2013 18:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259321 - stable/9/contrib/gperf/src X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 18:24:37 -0000 Author: pfg Date: Fri Dec 13 18:24:36 2013 New Revision: 259321 URL: http://svnweb.freebsd.org/changeset/base/259321 Log: MFC r258115 (partial); gperf: bring a small update from Apple Developers tools 4.4 From [1] offset.patch Makes use the C offsetof() macro. We are not merging the size_type.patch as it raises some (apparently) bogus warnings and is not really used. [1] http://opensource.apple.com/source/gperf/gperf-9/patches/ Modified: stable/9/contrib/gperf/src/output.cc Directory Properties: stable/9/ (props changed) stable/9/contrib/gperf/ (props changed) Modified: stable/9/contrib/gperf/src/output.cc ============================================================================== --- stable/9/contrib/gperf/src/output.cc Fri Dec 13 18:23:14 2013 (r259320) +++ stable/9/contrib/gperf/src/output.cc Fri Dec 13 18:24:36 2013 (r259321) @@ -1106,9 +1106,7 @@ output_keyword_entry (KeywordExt *temp, if (option[TYPE]) printf ("{"); if (option[SHAREDLIB]) - printf ("(int)(long)&((struct %s_t *)0)->%s_str%d", - option.get_stringpool_name (), option.get_stringpool_name (), - stringpool_index); + printf("offsetof(struct %s_t, %s_str%d)", option.get_stringpool_name (), option.get_stringpool_name (), stringpool_index); else output_string (temp->_allchars, temp->_allchars_length); if (option[TYPE]) @@ -2035,8 +2033,11 @@ Output::output () printf ("%s\n", _struct_decl); } - if (option[INCLUDE]) + if (option[INCLUDE]) { printf ("#include \n"); /* Declare strlen(), strcmp(), strncmp(). */ + if (option[SHAREDLIB]) + printf("#include \n"); /* Declare offsetof() */ + } if (!option[ENUM]) {