Silence -Wclobbered in each file that needs it.
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2184823009 Review-Url: https://codereview.chromium.org/2184823009
This commit is contained in:
parent
50d1847815
commit
03f704a343
@ -22,11 +22,6 @@
|
||||
'libpng.gyp:libpng',
|
||||
'libwebp.gyp:libwebp',
|
||||
],
|
||||
'cflags':[
|
||||
# FIXME: This gets around a warning: "Argument might be clobbered by longjmp".
|
||||
'-Wno-clobbered',
|
||||
'-Wno-unknown-warning-option',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../include/codec',
|
||||
'../include/private',
|
||||
|
@ -19,6 +19,12 @@
|
||||
#include <stdio.h>
|
||||
#include "SkJpegUtility.h"
|
||||
|
||||
// Same as setjmp, but introduces a new empty scope.
|
||||
// This way we can avoid GCC's overactive warnings about clobbered locals.
|
||||
static int setjmp_no_locals(jmp_buf env) {
|
||||
return setjmp(env);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#include "jerror.h"
|
||||
#include "jpeglib.h"
|
||||
@ -190,7 +196,7 @@ bool SkJpegCodec::ReadHeader(SkStream* stream, SkCodec** codecOut,
|
||||
SkAutoTDelete<JpegDecoderMgr> decoderMgr(new JpegDecoderMgr(stream));
|
||||
|
||||
// libjpeg errors will be caught and reported here
|
||||
if (setjmp(decoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(decoderMgr->getJmpBuf())) {
|
||||
return decoderMgr->returnFalse("setjmp");
|
||||
}
|
||||
|
||||
@ -414,7 +420,7 @@ bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) {
|
||||
* dimensions if possible
|
||||
*/
|
||||
bool SkJpegCodec::onDimensionsSupported(const SkISize& size) {
|
||||
if (setjmp(fDecoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
|
||||
return fDecoderMgr->returnFalse("onDimensionsSupported/setjmp");
|
||||
}
|
||||
|
||||
@ -466,7 +472,7 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
|
||||
jpeg_decompress_struct* dinfo = fDecoderMgr->dinfo();
|
||||
|
||||
// Set the jump location for libjpeg errors
|
||||
if (setjmp(fDecoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
|
||||
return fDecoderMgr->returnFailure("setjmp", kInvalidInput);
|
||||
}
|
||||
|
||||
@ -575,7 +581,7 @@ SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) {
|
||||
SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
|
||||
const Options& options, SkPMColor ctable[], int* ctableCount) {
|
||||
// Set the jump location for libjpeg errors
|
||||
if (setjmp(fDecoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
|
||||
SkCodecPrintf("setjmp: Error from libjpeg\n");
|
||||
return kInvalidInput;
|
||||
}
|
||||
@ -651,7 +657,7 @@ SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
|
||||
|
||||
int SkJpegCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
|
||||
// Set the jump location for libjpeg errors
|
||||
if (setjmp(fDecoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
|
||||
return fDecoderMgr->returnFailure("setjmp", kInvalidInput);
|
||||
}
|
||||
// Read rows one at a time
|
||||
@ -688,7 +694,7 @@ int SkJpegCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) {
|
||||
|
||||
bool SkJpegCodec::onSkipScanlines(int count) {
|
||||
// Set the jump location for libjpeg errors
|
||||
if (setjmp(fDecoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
|
||||
return fDecoderMgr->returnFalse("setjmp");
|
||||
}
|
||||
|
||||
@ -803,7 +809,7 @@ SkCodec::Result SkJpegCodec::onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void
|
||||
}
|
||||
|
||||
// Set the jump location for libjpeg errors
|
||||
if (setjmp(fDecoderMgr->getJmpBuf())) {
|
||||
if (setjmp_no_locals(fDecoderMgr->getJmpBuf())) {
|
||||
return fDecoderMgr->returnFailure("setjmp", kInvalidInput);
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include "SkTemplates.h"
|
||||
#include "SkUtils.h"
|
||||
|
||||
// This warning triggers false postives way too often in here.
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic ignored "-Wclobbered"
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Callback functions
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user