Closed Bug 1056941 Opened 5 years ago Closed 5 years ago

Fix GCC 4.9 compile errors

Categories

(Firefox for Android :: General, defect)

All
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 34

People

(Reporter: jchen, Assigned: jchen)

Details

Attachments

(3 files, 1 obsolete file)

Fennec can compile under GCC 4.9 with small changes.
We get a lot of "dangerous public destructor" errors when compiling with GCC 4.9. The concern is a public destructor for an XPCOM object can be called outside of Release(), and therefore can mess up reference counting. This patch refacors these classes to make affected destructors private.
Attachment #8478459 - Flags: review?(blassey.bugs)
GCC 4.9 complains about passing a string literal to putenv, which uses a (char*) argument. setenv uses (const char*) arguments, so setenv seems to be the correct call for string literals.
Attachment #8478460 - Flags: review?(mh+mozilla)
GCC 4.9 complains about unused local typedefs in stlport used for static assertion.
Attachment #8478462 - Flags: review?(mh+mozilla)
Comment on attachment 8478460 [details] [diff] [review]
Use setenv instead of putenv (v1)

Review of attachment 8478460 [details] [diff] [review]:
-----------------------------------------------------------------

::: mozglue/android/APKOpen.cpp
@@ +318,5 @@
>  
>  extern "C" NS_EXPORT void JNICALL
>  Java_org_mozilla_gecko_mozglue_GeckoLoader_loadSQLiteLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName, jboolean jShouldExtract) {
>    if (jShouldExtract) {
> +    setenv("MOZ_LINKER_EXTRACT", "1", true);

Looking at the calling code, there's actually no user of that branch anymore. Just remove the jShoudExtract argument entirely.

@@ +340,5 @@
>  
>  extern "C" NS_EXPORT void JNICALL
>  Java_org_mozilla_gecko_mozglue_GeckoLoader_loadNSSLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName, jboolean jShouldExtract) {
>    if (jShouldExtract) {
> +    setenv("MOZ_LINKER_EXTRACT", "1", true);

Likewise.
Attachment #8478460 - Flags: review?(mh+mozilla)
Attachment #8478460 - Flags: review-
Attachment #8478460 - Flags: review+
Attachment #8478462 - Flags: review?(mh+mozilla) → review+
Comment on attachment 8478459 [details] [diff] [review]
Fix dangerous destructors in Fennec code (v1)

Review of attachment 8478459 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/components/build/nsShellService.h
@@ +19,3 @@
>  
>  private:
> +  ~nsShellService() {}

is this just ws change? if so, drop it.
Attachment #8478459 - Flags: review?(blassey.bugs) → review+
Oops, I thought I got all r+'s so I landed all the patches. Here's the patch that removes the jShoudExtract argument. I'll backout the patch if it's not good.

Try: https://tbpl.mozilla.org/?tree=Try&rev=1b26432bdd1d
Attachment #8478460 - Attachment is obsolete: true
Attachment #8479258 - Flags: review?(mh+mozilla)
Attachment #8479258 - Flags: review?(mh+mozilla) → review+
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
You need to log in before you can comment on or make changes to this bug.