Closed Bug 316839 Opened 17 years ago Closed 17 years ago

Build fails in nsDeviceContextMac (GCC >= 4.0)

Categories

(Core Graveyard :: GFX: Mac, defect)

PowerPC
macOS
defect
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.9alpha1

People

(Reporter: krmathis, Assigned: mark)

References

Details

(Keywords: regression)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20051116 Camino/1.0+
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20051116 Camino/1.0+

Building todays trunk code fails on Mac OS 10.4.3, using GCC 4.0.1 / 10.4u SDK and this .mozconfig.
http://homepage.mac.com/krmathis/Trunk/mozconfig.txt

checkout finish: Thu Nov 17 13:30:25 CET 2005
While this code succeeded: checkout finish: Wed Nov 16 17:15:55 CET 2005

Reproducible: Always

Steps to Reproduce:
1. Pull latest trunk code.
2. Build using the above setup.

Actual Results:  
Build process errors out

Expected Results:  
Build process completes successfully


Short build log (longer one attached):
--------------------------------------
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp:829: error: invalid conversion from 'UInt8*' to 'const char*'
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp:829: error:   initializing argument 1 of 'nsDependentCString::nsDependentCString(const char*)'
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp:831: warning: 'FMGetFontFamilyFromATSFontFamilyRef' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Fonts.h:914)
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp:831: warning: 'FMGetFontFamilyFromATSFontFamilyRef' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Fonts.h:914)
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp: In function 'PRBool EnumerateFont(nsHashKey*, void*, void*)':
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp:1049: warning: 'FMGetFontFamilyTextEncoding' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Fonts.h:769)
/Users/krmathis/Camino/mozilla/gfx/src/mac/nsDeviceContextMac.cpp:1049: warning: 'FMGetFontFamilyTextEncoding' is deprecated (declared at /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Fonts.h:769)
make[6]: *** [nsDeviceContextMac.o] Error 1
make[5]: *** [libs] Error 2
make[4]: *** [libs] Error 2
make[3]: *** [libs_tier_9] Error 2
make[2]: *** [tier_9] Error 2
make[1]: *** [default] Error 2
make: *** [build] Error 2
Attached file Build-log
Build log showing output from last "c++ -o"
Version: unspecified → Trunk
Blocks: 213702
Keywords: regression
As I (on 10.3.9 w/ gcc3.3) can't reproduce this, would you try these?
1) do explicit typecasting
nsString temp = NS_ConvertUTF8toUTF16(nsDependentCString((const
char*)unicodeFontName));
in the line 829 of nsDeviceContextMac.cpp
2) change the array declaration to
char unicodeFontName[sizeof(fontName)];
in the line 823
3) sudo gcc_select 3.3
if the tree can be built, please check out the font list of Pref Pane. I'm afraid the FM funcs get obsolete (is there any doc about this? I couldn't find it.)
(In reply to comment #2)
> As I (on 10.3.9 w/ gcc3.3) can't reproduce this, would you try these?

I performed the steps, then executed "make -f client.mk build" and got this error message:
------------------
checking for valid optimization flags... no
configure: error: These compiler flags are invalid: -O3 -mcpu=7450 -faltivec -ftree-vectorize
*** Fix above errors and then restart with "make -f client.mk build"
make[1]: *** [configure] Error 1
make: *** [/Users/krmathis/Camino/mozilla/camino_7450_optimized/Makefile] Error 2
------------------

Building with the modified nsDeviceContextMac.cpp and GCC 4.0.1 errors out simular to my first report.
The cause is already in the "blocks" field: bug 213702.
Assignee: mikepinkerton → mark
Status: UNCONFIRMED → NEW
Component: General → GFX: Mac
Ever confirmed: true
Product: Camino → Core
Summary: Build errors out on nsDeviceContextMac (GCC 4.0.1 / 10.4u SDK) → Build fails in nsDeviceContextMac (GCC >= 4.0)
Target Milestone: --- → mozilla1.9alpha
The critical change for the error is:

-                       UInt8 unicodeFontName[sizeof(fontName)];
+                       char unicodeFontName[sizeof(fontName)];

Cleanup for warnings introduced by bug 213702:

-        TextEncoding oldFontEncoding = NULL;
+        TextEncoding oldFontEncoding = 0;

-                       unicodeFontName[actualOutputLength] = NULL;
+                       unicodeFontName[actualOutputLength] = '\0';

(TextEncoding is not a pointer, and C++ doesn't like it when you assign NULL to non-pointer types.)

Other changes are to clean up other warnings in the file, attachment 203377 [details], with the exception of the deprecation warnings.  I'm also dropping HasAppearanceManager, which always returns true on Mac OS X.
Attachment #203399 - Flags: superreview?(mikepinkerton)
Attachment #203399 - Flags: review?(joshmoz)
Thanks for the patch. I will try it asap. I reported the building crash in bug 213702 a few hours ago.
Attachment #203399 - Flags: review?(joshmoz) → review+
(In reply to comment #5)
> Created an attachment (id=203399) [edit]
> Fix nsDeviceContextMac.cpp errors and warnings

I applied the patch and successfully compiled Camino
Seems like you nailed the bug!
Same here for fx.

Thanks for fixing this crash ;)
Comment on attachment 203399 [details] [diff] [review]
Fix nsDeviceContextMac.cpp errors and warnings

pinkerton gave sr on IRC with the casts changed to NS_STATIC_CAST.
Attachment #203399 - Flags: superreview?(mikepinkerton) → superreview+
Checked in on trunk.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.