Bug 127297 - Redefinition warnings in print/freetype2
Summary: Redefinition warnings in print/freetype2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-11 11:20 UTC by Jeremy Chadwick
Modified: 2008-09-25 04:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Chadwick freebsd_committer freebsd_triage 2008-09-11 11:20:02 UTC
	During the build of print/freetype2, a very large number of warnings
	are emitted due to the re-definition of TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
	Example:

In file included from ./builds/unix/ftconfig.h:42,
                 from /usr/ports/print/freetype2/work/freetype-2.3.7/src/base/ftinit.c:41:
/usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/config/ftoption.h:462:1: warning: "TT_CONFIG_OPTION_BYTECODE_INTERPRETER" redefined
<command line>:4:1: warning: this is the location of the previous definition

	The port Makefile is causing this situation due to a bug.

	The pre-patch section comments out #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER in
	include/freetype/config/ftoption.h (when WITHOUT_TTF_BYTECODE_ENABLED is not
	defined by the user), but then earlier in the Makefile, it re-enables it:

.if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
CFLAGS+=        -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER
.endif

	The solution is to remove the CFLAGS+=-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER
	piece of the Makefile.

Fix: Below is the attached patch.  I'd commit this myself, but we're in a
	code freeze, and I also don't want to offend any of the gnome@ folks.



Assuming gnome@ gives the thumbs up, I can commit this.  I've tested
	it when using WITHOUT_TTF_BYTECODE_ENABLED=yes and without; the
	REINPLACE_CMD part of pre-patch does the right thing altogether.--hLys7v86eZFXifzSwU4hhAj7E3ZyszuBOm32IjyYz2UziFqp
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/print/freetype2/Makefile,v
retrieving revision 1.82
diff -u -r1.82 Makefile
--- Makefile	2 Jul 2008 19:58:12 -0000	1.82
+++ Makefile	11 Sep 2008 09:47:00 -0000
@@ -32,10 +32,6 @@
 CONFIGURE_ARGS=	--disable-nls
 CONFIGURE_WRKSRC=	${WRKSRC}/builds/unix
 
-.if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
-CFLAGS+=	-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER
-.endif
-
 .if defined(WITH_LCD_FILTERING)
 CFLAGS+=	-DFT_CONFIG_OPTION_SUBPIXEL_RENDERING
 .endif
How-To-Repeat: 	Build print/freetype2 normally -- make sure you DO NOT have
	WITHOUT_TTF_BYTECODE_ENABLED=yes anywhere
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-09-11 11:20:13 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Jeremy Messenger 2008-09-24 17:58:26 UTC
> The pre-patch section comments out #define
> TT_CONFIG_OPTION_BYTECODE_INTERPRETER in
> include/freetype/config/ftoption.h (when WITHOUT_TTF_BYTECODE_ENABLED is
> not defined by the user), but then earlier in the Makefile, it
> re-enables it:

I am not seeing any bug. When the WITHOUT_TTF_BYTECODE_ENABLED is not  
defined then the TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be enable,  
which is a correct behavior. Unless I am blind?

--------------------------------------------------------
# pwd
/usr/ports/print/freetype2
# make extract
# grep TT_CONFIG_OPTION_BYTECODE_INTERPRETER  
work/freetype-2.3.7/include/freetype/config/ftoption.h
   /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile    
*/
/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ <-- disable
   /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words,        
*/
   /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                 
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER

# make patch
# grep TT_CONFIG_OPTION_BYTECODE_INTERPRETER  
work/freetype-2.3.7/include/freetype/config/ftoption.h
   /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile    
*/
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER <-- enable
   /* define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; with other words,        
*/
   /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                 
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
--------------------------------------------------------

There is no problem. As for the redefine warning, I think it's harmless  
since it's still enable with no change as it's merely enable again.

Cheers,
Mezz


-- 
mezz7@cox.net  -  mezz@FreeBSD.org
FreeBSD GNOME Team
http://www.FreeBSD.org/gnome/  -  gnome@FreeBSD.org
Comment 3 Jeremy Chadwick freebsd_committer freebsd_triage 2008-09-24 23:07:20 UTC
On Wed, Sep 24, 2008 at 11:58:26AM -0500, Jeremy Messenger wrote:
>> The pre-patch section comments out #define
>> TT_CONFIG_OPTION_BYTECODE_INTERPRETER in
>> include/freetype/config/ftoption.h (when WITHOUT_TTF_BYTECODE_ENABLED is
>> not defined by the user), but then earlier in the Makefile, it
>> re-enables it:
>
> I am not seeing any bug. When the WITHOUT_TTF_BYTECODE_ENABLED is not  
> defined then the TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be enable,  
> which is a correct behavior. Unless I am blind?
>
> {snip}
>
> There is no problem. As for the redefine warning, I think it's harmless  
> since it's still enable with no change as it's merely enable again.

The bug is in the port Makefile as I described.  The CFLAGS addition of
-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER is 100% worthless, and induces
the warnings.

Let's step through each piece of the build process.

Someone ultimately does "make" in ports/print/freetype2.  They do not
have WITHOUT_TTF_BYTECODE_ENABLED defined.

In the port Makefile:

.if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
CFLAGS+=        -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER
.endif

At this point TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be defined
during the build of the actual program.  You can even see it being
defined forcefully in "cc".

Then later, in the port Makefile, we find this:

.if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
	@${REINPLACE_CMD} -e '/#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER/s,/\* \(.*\) \*/,\1,; /#define TT_CONFIG_OPTION_UNPATENTED_HINTING/s,^\(.*\),/* \1 \*/,' \
		${WRKSRC}/include/freetype/config/ftoption.h
.endif

The $REINPLACE_CMD code never gets executed, which makes sense because
WITHOUT_TTF_BYTECODE_ENABLED is not defined.

So let's see what include/freetype/config/ftoption.h contains shall we?

$ egrep '(#define|#undef) TT_CONFIG_OPTION_BYTECODE_INTERPRETER' work/freetype-2.3.7/include/freetype/config/ftoption.h
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER

Oh look, it's being #define'd in the .h file already!

So what's the purpose of the CFLAGS part?  To induce warnings?  :-)
Seeing this per *every C file* for no good reason is absurd:

In file included from ./builds/unix/ftconfig.h:42, from
/usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/freetype.h:41, from
/usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/ftmodapi.h:24, from
/usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/ftrender.h:24, from
/usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/internal/ftobjs.h:30, from
/usr/ports/print/freetype2/work/freetype-2.3.7/src/smooth/ftgrays.c:141, from
/usr/ports/print/freetype2/work/freetype-2.3.7/src/smooth/smooth.c:22:
/usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/config/ftoption.h:462:1: warning: "TT_CONFIG_OPTION_BYTECODE_INTERPRETER" redefined
<command-line>: warning: this is the location of the previous definition

I'm begging you to try it for yourself.  Remove the CFLAGS modifier
portion of the Makefile and then:

# cd /usr/ports/print/freetype2
# make clean
# make

You won't see any warnings.

And try it with WITHOUT_TTF_BYTECODE_ENABLED=true too:

# cd /usr/ports/print/freetype2
# make clean
# make WITHOUT_TTF_BYTECODE_ENABLED=true

No warnings, and TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be
commented out in the .h file (as expected), because the $REINPLACE_CMD
code will take care of it.

Please reconsider your "there is no bug here" comment.  There is most
definitely a bug -- the FreeBSD port Makefile is causing tons of
unnecessary warnings for *no good reason*.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |
Comment 4 Jeremy Messenger 2008-09-24 23:18:14 UTC
On Wed, 24 Sep 2008 17:07:20 -0500, Jeremy Chadwick <koitsu@freebsd.org>  
wrote:

> On Wed, Sep 24, 2008 at 11:58:26AM -0500, Jeremy Messenger wrote:
>>> The pre-patch section comments out #define
>>> TT_CONFIG_OPTION_BYTECODE_INTERPRETER in
>>> include/freetype/config/ftoption.h (when WITHOUT_TTF_BYTECODE_ENABLED  
>>> is
>>> not defined by the user), but then earlier in the Makefile, it
>>> re-enables it:
>>
>> I am not seeing any bug. When the WITHOUT_TTF_BYTECODE_ENABLED is not
>> defined then the TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be enable,
>> which is a correct behavior. Unless I am blind?
>>
>> {snip}
>>
>> There is no problem. As for the redefine warning, I think it's harmless
>> since it's still enable with no change as it's merely enable again.
>
> The bug is in the port Makefile as I described.  The CFLAGS addition of
> -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER is 100% worthless, and induces
> the warnings.
>
> Let's step through each piece of the build process.
>
> Someone ultimately does "make" in ports/print/freetype2.  They do not
> have WITHOUT_TTF_BYTECODE_ENABLED defined.
>
> In the port Makefile:
>
> .if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
> CFLAGS+=        -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER
> .endif
>
> At this point TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be defined
> during the build of the actual program.  You can even see it being
> defined forcefully in "cc".
>
> Then later, in the port Makefile, we find this:
>
> .if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
> 	@${REINPLACE_CMD} -e '/#define  
> TT_CONFIG_OPTION_BYTECODE_INTERPRETER/s,/\* \(.*\) \*/,\1,; /#define  
> TT_CONFIG_OPTION_UNPATENTED_HINTING/s,^\(.*\),/* \1 \*/,' \
> 		${WRKSRC}/include/freetype/config/ftoption.h
> .endif
>
> The $REINPLACE_CMD code never gets executed, which makes sense because
> WITHOUT_TTF_BYTECODE_ENABLED is not defined.

Incorrect. See that '!', so the REINPLACE_CMD does get executed. It's why  
I have shown you my example.

> So let's see what include/freetype/config/ftoption.h contains shall we?
>
> $ egrep '(#define|#undef) TT_CONFIG_OPTION_BYTECODE_INTERPRETER'  
> work/freetype-2.3.7/include/freetype/config/ftoption.h
> #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
>
> Oh look, it's being #define'd in the .h file already!
>
> So what's the purpose of the CFLAGS part?  To induce warnings?  :-)
> Seeing this per *every C file* for no good reason is absurd:
>
> In file included from ./builds/unix/ftconfig.h:42, from
> /usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/freetype.h:41,  
> from
> /usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/ftmodapi.h:24,  
> from
> /usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/ftrender.h:24,  
> from
> /usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/internal/ftobjs.h:30,  
> from
> /usr/ports/print/freetype2/work/freetype-2.3.7/src/smooth/ftgrays.c:141,  
> from
> /usr/ports/print/freetype2/work/freetype-2.3.7/src/smooth/smooth.c:22:
> /usr/ports/print/freetype2/work/freetype-2.3.7/include/freetype/config/ftoption.h:462:1:  
> warning: "TT_CONFIG_OPTION_BYTECODE_INTERPRETER" redefined
> <command-line>: warning: this is the location of the previous definition
>
> I'm begging you to try it for yourself.  Remove the CFLAGS modifier
> portion of the Makefile and then:
>
> # cd /usr/ports/print/freetype2
> # make clean
> # make
>
> You won't see any warnings.
>
> And try it with WITHOUT_TTF_BYTECODE_ENABLED=true too:
>
> # cd /usr/ports/print/freetype2
> # make clean
> # make WITHOUT_TTF_BYTECODE_ENABLED=true
>
> No warnings, and TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be
> commented out in the .h file (as expected), because the $REINPLACE_CMD
> code will take care of it.
>
> Please reconsider your "there is no bug here" comment.  There is most
> definitely a bug -- the FreeBSD port Makefile is causing tons of
> unnecessary warnings for *no good reason*.

The warnings don't mean it's bug.

Cheers,
Mezz


-- 
mezz7@cox.net  -  mezz@FreeBSD.org
FreeBSD GNOME Team
http://www.FreeBSD.org/gnome/  -  gnome@FreeBSD.org
Comment 5 Joe Marcus Clarke freebsd_committer freebsd_triage 2008-09-24 23:53:34 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 6 dfilter service freebsd_committer freebsd_triage 2008-09-24 23:53:35 UTC
marcus      2008-09-24 22:53:22 UTC

  FreeBSD ports repository

  Modified files:
    print/freetype2      Makefile 
  Log:
  Remove the redundant CFLAGS definition for
  TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
  
  PR:             127297
  Submitted by:   koitsu
  
  Revision  Changes    Path
  1.83      +0 -4      ports/print/freetype2/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 7 Jeremy Chadwick freebsd_committer freebsd_triage 2008-09-25 00:29:11 UTC
On Wed, Sep 24, 2008 at 05:18:14PM -0500, Jeremy Messenger wrote:
> On Wed, 24 Sep 2008 17:07:20 -0500, Jeremy Chadwick <koitsu@freebsd.org>  
> wrote:
>
>> On Wed, Sep 24, 2008 at 11:58:26AM -0500, Jeremy Messenger wrote:
>>>> The pre-patch section comments out #define
>>>> TT_CONFIG_OPTION_BYTECODE_INTERPRETER in
>>>> include/freetype/config/ftoption.h (when 
>>>> WITHOUT_TTF_BYTECODE_ENABLED is
>>>> not defined by the user), but then earlier in the Makefile, it
>>>> re-enables it:
>>>
>>> I am not seeing any bug. When the WITHOUT_TTF_BYTECODE_ENABLED is not
>>> defined then the TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be enable,
>>> which is a correct behavior. Unless I am blind?
>>>
>>> {snip}
>>>
>>> There is no problem. As for the redefine warning, I think it's harmless
>>> since it's still enable with no change as it's merely enable again.
>>
>> The bug is in the port Makefile as I described.  The CFLAGS addition of
>> -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER is 100% worthless, and induces
>> the warnings.
>>
>> Let's step through each piece of the build process.
>>
>> Someone ultimately does "make" in ports/print/freetype2.  They do not
>> have WITHOUT_TTF_BYTECODE_ENABLED defined.
>>
>> In the port Makefile:
>>
>> .if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
>> CFLAGS+=        -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER
>> .endif
>>
>> At this point TT_CONFIG_OPTION_BYTECODE_INTERPRETER will be defined
>> during the build of the actual program.  You can even see it being
>> defined forcefully in "cc".
>>
>> Then later, in the port Makefile, we find this:
>>
>> .if !defined(WITHOUT_TTF_BYTECODE_ENABLED)
>> 	@${REINPLACE_CMD} -e '/#define  
>> TT_CONFIG_OPTION_BYTECODE_INTERPRETER/s,/\* \(.*\) \*/,\1,; /#define  
>> TT_CONFIG_OPTION_UNPATENTED_HINTING/s,^\(.*\),/* \1 \*/,' \
>> 		${WRKSRC}/include/freetype/config/ftoption.h
>> .endif
>>
>> The $REINPLACE_CMD code never gets executed, which makes sense because
>> WITHOUT_TTF_BYTECODE_ENABLED is not defined.
>
> Incorrect. See that '!', so the REINPLACE_CMD does get executed. It's why 
> I have shown you my example.

Yes you're right -- it does get executed.  I was incorrect.

But this is part of the problem.  The REINPLACE_CMD causes this to
happen (ftconfig.h) when WITHOUT_TTF_BYTECODE_ENABLED is not defined:

-/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER

Which ultimately means the #define happens in the .h, ***AND*** being
defined via cc ...  -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER.

So again -- what is the point of the CFLAGS modifier part of the
Makefile when you're already doing it with the REINPLACE_CMD?  :-)

> The warnings don't mean it's bug.

Are you *serious*?  Wow.  Just... wow.

Shall I close the PR?

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |
Comment 8 Jeremy Chadwick freebsd_committer freebsd_triage 2008-09-25 00:30:07 UTC
On Wed, Sep 24, 2008 at 04:29:11PM -0700, Jeremy Chadwick wrote:
> Shall I close the PR?

Looks like marcus@ already committed it and closed it.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |
Comment 9 Jeremy Messenger 2008-09-25 04:39:03 UTC
On Wed, 24 Sep 2008 18:30:07 -0500, Jeremy Chadwick <koitsu@freebsd.org>  
wrote:

> On Wed, Sep 24, 2008 at 04:29:11PM -0700, Jeremy Chadwick wrote:
>> Shall I close the PR?
>
> Looks like marcus@ already committed it and closed it.

Yes, I have asked him to handle this PR. He has agreed with me for  
harmless. I knew about that it's double defined, but it's still not a bug  
because it was unchange. If the double define actually change the orignal  
then it's a bug. The reason why I don't care about double define is that  
it does not change, and what if one of file has forgotten to include the  
ftconfig.h then that double define would cover this problem. ;-)

Cheers,
Mezz


-- 
mezz7@cox.net  -  mezz@FreeBSD.org
FreeBSD GNOME Team
http://www.FreeBSD.org/gnome/  -  gnome@FreeBSD.org