Merge "Frameworks/base: Turn on -Wall -Werror in cmds"
This commit is contained in:
@@ -21,6 +21,9 @@ LOCAL_MODULE:= app_process
|
|||||||
LOCAL_MULTILIB := both
|
LOCAL_MULTILIB := both
|
||||||
LOCAL_MODULE_STEM_32 := app_process32
|
LOCAL_MODULE_STEM_32 := app_process32
|
||||||
LOCAL_MODULE_STEM_64 := app_process64
|
LOCAL_MODULE_STEM_64 := app_process64
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
# Create a symlink from app_process to app_process32 or 64
|
# Create a symlink from app_process to app_process32 or 64
|
||||||
@@ -54,6 +57,8 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)/asan
|
|||||||
LOCAL_MODULE_STEM := app_process
|
LOCAL_MODULE_STEM := app_process
|
||||||
LOCAL_ADDRESS_SANITIZER := true
|
LOCAL_ADDRESS_SANITIZER := true
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
endif # ifeq($(TARGET_ARCH),arm)
|
endif # ifeq($(TARGET_ARCH),arm)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
void app_usage()
|
static void app_usage()
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: app_process [java-options] cmd-dir start-class-name [options]\n");
|
"Usage: app_process [java-options] cmd-dir start-class-name [options]\n");
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ LOCAL_MODULE:= btool
|
|||||||
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
|
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ using namespace android;
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int
|
static int usage(int /* argc */, const char** argv)
|
||||||
usage(int argc, const char** argv)
|
|
||||||
{
|
{
|
||||||
const char* p = argv[0];
|
const char* p = argv[0];
|
||||||
|
|
||||||
@@ -44,15 +43,13 @@ usage(int argc, const char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int perform_full_backup()
|
||||||
perform_full_backup()
|
|
||||||
{
|
{
|
||||||
printf("this would have written all of your data to stdout\n");
|
printf("this would have written all of your data to stdout\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int perform_list(const char* filename)
|
||||||
perform_list(const char* filename)
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -95,14 +92,13 @@ perform_list(const char* filename)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int perform_print(const char* entityname, const char* filename)
|
static int perform_print(const char* entityname, const char* filename)
|
||||||
{
|
{
|
||||||
printf("perform_print(%s, %s);", entityname, filename);
|
printf("perform_print(%s, %s);", entityname, filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int main(int argc, const char** argv)
|
||||||
main(int argc, const char** argv)
|
|
||||||
{
|
{
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
return perform_full_backup();
|
return perform_full_backup();
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ LOCAL_SRC_FILES:= \
|
|||||||
|
|
||||||
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
|
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
LOCAL_C_INCLUDES += external/tinyalsa/include
|
LOCAL_C_INCLUDES += external/tinyalsa/include
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
|
|||||||
@@ -207,7 +207,6 @@ bool AudioPlayer::threadLoop()
|
|||||||
struct pcm *pcm = NULL;
|
struct pcm *pcm = NULL;
|
||||||
bool moreChunks = true;
|
bool moreChunks = true;
|
||||||
const struct chunk_fmt* chunkFmt = NULL;
|
const struct chunk_fmt* chunkFmt = NULL;
|
||||||
void* buffer = NULL;
|
|
||||||
int bufferSize;
|
int bufferSize;
|
||||||
const uint8_t* wavData;
|
const uint8_t* wavData;
|
||||||
size_t wavLength;
|
size_t wavLength;
|
||||||
|
|||||||
@@ -42,9 +42,13 @@
|
|||||||
#include <gui/Surface.h>
|
#include <gui/Surface.h>
|
||||||
#include <gui/SurfaceComposerClient.h>
|
#include <gui/SurfaceComposerClient.h>
|
||||||
|
|
||||||
|
// TODO: Fix Skia.
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
#include <SkBitmap.h>
|
#include <SkBitmap.h>
|
||||||
#include <SkStream.h>
|
#include <SkStream.h>
|
||||||
#include <SkImageDecoder.h>
|
#include <SkImageDecoder.h>
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
#include <GLES/glext.h>
|
#include <GLES/glext.h>
|
||||||
@@ -105,7 +109,7 @@ void BootAnimation::binderDied(const wp<IBinder>&)
|
|||||||
status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,
|
status_t BootAnimation::initTexture(Texture* texture, AssetManager& assets,
|
||||||
const char* name) {
|
const char* name) {
|
||||||
Asset* asset = assets.open(name, Asset::ACCESS_BUFFER);
|
Asset* asset = assets.open(name, Asset::ACCESS_BUFFER);
|
||||||
if (!asset)
|
if (asset == NULL)
|
||||||
return NO_INIT;
|
return NO_INIT;
|
||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
SkImageDecoder::DecodeMemory(asset->getBuffer(false), asset->getLength(),
|
SkImageDecoder::DecodeMemory(asset->getBuffer(false), asset->getLength(),
|
||||||
@@ -164,7 +168,7 @@ status_t BootAnimation::initTexture(const Animation::Frame& frame)
|
|||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
SkMemoryStream stream(frame.map->getDataPtr(), frame.map->getDataLength());
|
SkMemoryStream stream(frame.map->getDataPtr(), frame.map->getDataLength());
|
||||||
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
|
SkImageDecoder* codec = SkImageDecoder::Factory(&stream);
|
||||||
if (codec) {
|
if (codec != NULL) {
|
||||||
codec->setDitherImage(false);
|
codec->setDitherImage(false);
|
||||||
codec->decode(&stream, &bitmap,
|
codec->decode(&stream, &bitmap,
|
||||||
kN32_SkColorType,
|
kN32_SkColorType,
|
||||||
@@ -252,7 +256,7 @@ status_t BootAnimation::readyToRun() {
|
|||||||
EGL_DEPTH_SIZE, 0,
|
EGL_DEPTH_SIZE, 0,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
EGLint w, h, dummy;
|
EGLint w, h;
|
||||||
EGLint numConfigs;
|
EGLint numConfigs;
|
||||||
EGLConfig config;
|
EGLConfig config;
|
||||||
EGLSurface surface;
|
EGLSurface surface;
|
||||||
@@ -470,7 +474,7 @@ bool BootAnimation::movie()
|
|||||||
// Parse the description file
|
// Parse the description file
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const char* endl = strstr(s, "\n");
|
const char* endl = strstr(s, "\n");
|
||||||
if (!endl) break;
|
if (endl == NULL) break;
|
||||||
String8 line(s, endl - s);
|
String8 line(s, endl - s);
|
||||||
const char* l = line.string();
|
const char* l = line.string();
|
||||||
int fps, width, height, count, pause;
|
int fps, width, height, count, pause;
|
||||||
@@ -572,7 +576,6 @@ bool BootAnimation::movie()
|
|||||||
|
|
||||||
const int xc = (mWidth - animation.width) / 2;
|
const int xc = (mWidth - animation.width) / 2;
|
||||||
const int yc = ((mHeight - animation.height) / 2);
|
const int yc = ((mHeight - animation.height) / 2);
|
||||||
nsecs_t lastFrame = systemTime();
|
|
||||||
nsecs_t frameDuration = s2ns(1) / animation.fps;
|
nsecs_t frameDuration = s2ns(1) / animation.fps;
|
||||||
|
|
||||||
Region clearReg(Rect(mWidth, mHeight));
|
Region clearReg(Rect(mWidth, mHeight));
|
||||||
@@ -620,9 +623,9 @@ bool BootAnimation::movie()
|
|||||||
Region::const_iterator tail(clearReg.end());
|
Region::const_iterator tail(clearReg.end());
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
while (head != tail) {
|
while (head != tail) {
|
||||||
const Rect& r(*head++);
|
const Rect& r2(*head++);
|
||||||
glScissor(r.left, mHeight - r.bottom,
|
glScissor(r2.left, mHeight - r2.bottom,
|
||||||
r.width(), r.height());
|
r2.width(), r2.height());
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ using namespace android;
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main()
|
||||||
{
|
{
|
||||||
#if defined(HAVE_PTHREADS)
|
#if defined(HAVE_PTHREADS)
|
||||||
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
|
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
|
||||||
|
|||||||
@@ -25,4 +25,6 @@ LOCAL_C_INCLUDES := external/zlib
|
|||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace {
|
|||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!zip->getEntryInfo(entry, NULL, NULL, NULL, NULL, NULL, (long*)crc)) {
|
if (!zip->getEntryInfo(entry, NULL, NULL, NULL, NULL, NULL, reinterpret_cast<long*>(crc))) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
zip->releaseEntry(entry);
|
zip->releaseEntry(entry);
|
||||||
@@ -66,7 +66,7 @@ fail:
|
|||||||
fprintf(stderr, "error: write: %s\n", strerror(errno));
|
fprintf(stderr, "error: write: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
bytesLeft -= w;
|
bytesLeft -= static_cast<size_t>(w);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buf[N];
|
char buf[N];
|
||||||
ssize_t bytesLeft = N;
|
size_t bytesLeft = N;
|
||||||
if (lseek(idmap_fd, SEEK_SET, 0) < 0) {
|
if (lseek(idmap_fd, SEEK_SET, 0) < 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ fail:
|
|||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bytesLeft -= r;
|
bytesLeft -= static_cast<size_t>(r);
|
||||||
if (bytesLeft == 0) {
|
if (bytesLeft == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,13 +152,13 @@ namespace {
|
|||||||
printe("failed to get resource name id=0x%08x\n", res_id);
|
printe("failed to get resource name id=0x%08x\n", res_id);
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
if (package) {
|
if (package != NULL) {
|
||||||
*package = String8(String16(data.package, data.packageLen));
|
*package = String8(String16(data.package, data.packageLen));
|
||||||
}
|
}
|
||||||
if (type) {
|
if (type != NULL) {
|
||||||
*type = String8(String16(data.type, data.typeLen));
|
*type = String8(String16(data.type, data.typeLen));
|
||||||
}
|
}
|
||||||
if (name) {
|
if (name != NULL) {
|
||||||
*name = String8(String16(data.name, data.nameLen));
|
*name = String8(String16(data.name, data.nameLen));
|
||||||
}
|
}
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
|
|||||||
@@ -64,30 +64,6 @@ namespace {
|
|||||||
return String8(tmp);
|
return String8(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mkdir_p(const String8& path, uid_t uid, gid_t gid)
|
|
||||||
{
|
|
||||||
static const mode_t mode =
|
|
||||||
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if (stat(path.string(), &st) == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (mkdir_p(path.getPathDir(), uid, gid) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (mkdir(path.string(), 0755) != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (chown(path.string(), uid, gid) == -1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (chmod(path.string(), mode) == -1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_overlay_tag(const ResXMLTree& parser, const char *target_package_name)
|
int parse_overlay_tag(const ResXMLTree& parser, const char *target_package_name)
|
||||||
{
|
{
|
||||||
const size_t N = parser.getAttributeCount();
|
const size_t N = parser.getAttributeCount();
|
||||||
@@ -98,7 +74,7 @@ namespace {
|
|||||||
String16 key(parser.getAttributeName(i, &len));
|
String16 key(parser.getAttributeName(i, &len));
|
||||||
if (key == String16("targetPackage")) {
|
if (key == String16("targetPackage")) {
|
||||||
const uint16_t *p = parser.getAttributeStringValue(i, &len);
|
const uint16_t *p = parser.getAttributeStringValue(i, &len);
|
||||||
if (p) {
|
if (p != NULL) {
|
||||||
target = String16(p, len);
|
target = String16(p, len);
|
||||||
}
|
}
|
||||||
} else if (key == String16("priority")) {
|
} else if (key == String16("priority")) {
|
||||||
@@ -164,7 +140,7 @@ namespace {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
FileMap *dataMap = zip->createEntryFileMap(entry);
|
FileMap *dataMap = zip->createEntryFileMap(entry);
|
||||||
if (!dataMap) {
|
if (dataMap == NULL) {
|
||||||
ALOGW("%s: failed to create FileMap\n", __FUNCTION__);
|
ALOGW("%s: failed to create FileMap\n", __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ LOCAL_SRC_FILES := \
|
|||||||
LOCAL_MODULE := interrupter
|
LOCAL_MODULE := interrupter
|
||||||
LOCAL_MODULE_TAGS := eng tests
|
LOCAL_MODULE_TAGS := eng tests
|
||||||
LOCAL_LDFLAGS := -ldl
|
LOCAL_LDFLAGS := -ldl
|
||||||
|
LOCAL_CFLAGS := -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
@@ -17,5 +18,6 @@ LOCAL_SRC_FILES := \
|
|||||||
LOCAL_MODULE := interrupter
|
LOCAL_MODULE := interrupter
|
||||||
LOCAL_MODULE_TAGS := eng tests
|
LOCAL_MODULE_TAGS := eng tests
|
||||||
LOCAL_LDFLAGS := -ldl
|
LOCAL_LDFLAGS := -ldl
|
||||||
|
LOCAL_CFLAGS := -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_HOST_SHARED_LIBRARY)
|
include $(BUILD_HOST_SHARED_LIBRARY)
|
||||||
@@ -16,4 +16,6 @@ LOCAL_MODULE:= screencap
|
|||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
|
|
||||||
|
LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|||||||
@@ -32,10 +32,14 @@
|
|||||||
|
|
||||||
#include <ui/PixelFormat.h>
|
#include <ui/PixelFormat.h>
|
||||||
|
|
||||||
|
// TODO: Fix Skia.
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
#include <SkImageEncoder.h>
|
#include <SkImageEncoder.h>
|
||||||
#include <SkBitmap.h>
|
#include <SkBitmap.h>
|
||||||
#include <SkData.h>
|
#include <SkData.h>
|
||||||
#include <SkStream.h>
|
#include <SkStream.h>
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
using namespace android;
|
using namespace android;
|
||||||
|
|
||||||
@@ -129,7 +133,7 @@ int main(int argc, char** argv)
|
|||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
const char* fn;
|
const char* fn = NULL;
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
fd = dup(STDOUT_FILENO);
|
fd = dup(STDOUT_FILENO);
|
||||||
} else if (argc == 1) {
|
} else if (argc == 1) {
|
||||||
@@ -153,7 +157,7 @@ int main(int argc, char** argv)
|
|||||||
void const* mapbase = MAP_FAILED;
|
void const* mapbase = MAP_FAILED;
|
||||||
ssize_t mapsize = -1;
|
ssize_t mapsize = -1;
|
||||||
|
|
||||||
void const* base = 0;
|
void const* base = NULL;
|
||||||
uint32_t w, s, h, f;
|
uint32_t w, s, h, f;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
@@ -190,7 +194,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base) {
|
if (base != NULL) {
|
||||||
if (png) {
|
if (png) {
|
||||||
const SkImageInfo info = SkImageInfo::Make(w, h, flinger2skia(f),
|
const SkImageInfo info = SkImageInfo::Make(w, h, flinger2skia(f),
|
||||||
kPremul_SkAlphaType);
|
kPremul_SkAlphaType);
|
||||||
@@ -202,7 +206,9 @@ int main(int argc, char** argv)
|
|||||||
SkData* streamData = stream.copyToData();
|
SkData* streamData = stream.copyToData();
|
||||||
write(fd, streamData->data(), streamData->size());
|
write(fd, streamData->data(), streamData->size());
|
||||||
streamData->unref();
|
streamData->unref();
|
||||||
|
if (fn != NULL) {
|
||||||
notifyMediaScanner(fn);
|
notifyMediaScanner(fn);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
write(fd, &w, 4);
|
write(fd, &w, 4);
|
||||||
write(fd, &h, 4);
|
write(fd, &h, 4);
|
||||||
|
|||||||
Reference in New Issue
Block a user