Closed Bug 1393216 Opened 2 years ago Closed 2 years ago

When compiling for Windows with gcc, we encounter lots of #pragma warning's - which generate warnings


(Core :: General, defect)

Not set



Tracking Status
firefox57 --- fixed


(Reporter: tjr, Assigned: tjr)


(Blocks 1 open bug)


(Whiteboard: [tor])


(1 file)

MSVC supports #pragma warning() which is used to enable or disable warnings in a very nuanced way.

gcc doesn't recognize these, and generates a warning saying 'Unknown Pragma'
Try run:

(The build will break, but the log shouldn't have any 'ignoring #pragma warning')
Comment on attachment 8900451 [details]
Bug 1393216 Disable unknown pragma warnings when compiling for Windows with gcc

r=me with the change below.

::: build/moz.configure/warnings.configure:112
(Diff revision 1)
>  # We use mix of both POSIX and Win32 printf format across the tree, so format
>  # warnings are useless on mingw.
>  check_and_add_gcc_warning('-Wno-format',
>                            when=depends(target)(lambda t: t.kernel == 'WINNT'))
> +# When compiling for Windows with gcc, we hit lots of #pragma warning's which gcc does not recognize

Nit: maybe "...lots of "#pragma warning"s, which is an MSVC-only pragma thatn GCC does not recognize."  The quoting of "#pragma warning" is important here, I think.

(Note that we disable the warning on clang-cl too, for much the same reason.)
Attachment #8900451 - Flags: review?(nfroyd) → review+
Keywords: checkin-needed
Autoland can't push this until all pending issues in MozReview are marked as resolved.
Flags: needinfo?(tom)
Keywords: checkin-needed
Flags: needinfo?(tom)
Keywords: checkin-needed
Pushed by
Disable unknown pragma warnings when compiling for Windows with gcc r=froydnj
Keywords: checkin-needed
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
No longer blocks: 1330608
Blocks: 1394433
You need to log in before you can comment on or make changes to this bug.