cleanup two c tests that were causing clang warnings

Summary: public
This caused scary red output in buck.

Reviewed By: akotulski

Differential Revision: D2652135

fb-gh-sync-id: 52d6e7e
master
Jules Villard 9 years ago committed by facebook-github-bot-7
parent c4b237e9f6
commit 2367b1c9ff

@ -7,17 +7,23 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warray-bounds"
void bound_error() { void bound_error() {
int a[7]; int a[7];
a[7] = 4; a[7] = 4;
} }
#pragma clang diagnostic pop
void nested_array_ok() { void nested_array_ok() {
int a[3][4][5]; int a[3][4][5];
a[2][3][4] = 0; a[2][3][4] = 0;
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warray-bounds"
void bound_error_nested() { void bound_error_nested() {
int a[3][4][5]; int a[3][4][5];
a[4][3][2] = 0; a[4][3][2] = 0;
} }
#pragma clang diagnostic pop

@ -1,43 +1,41 @@
/*
* Copyright (c) 2015 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int *set42(int* x) { int *set42(int* x) {
*x = 42;
*x=42;
return x; return x;
} }
void nodpd () { void nodpd () {
int w,*z;
int w,z; z = set42(&w);
z=set42(&w);
} }
void nodpd1 () { void nodpd1 () {
int *y = malloc(sizeof(int)); int *y = malloc(sizeof(int));
int *z; int *z;
z=set42(y); z = set42(y);
free(y); free(y);
} }
void dpd () { void dpd () {
int *y; int *y;
int *z; int *z;
z=set42(y); z = set42(y);
} }
void intraprocdpd () { void intraprocdpd () {
int *y; int *y;
int *z; int *z;
*y=42; *y = 42;
z=y; z = y;
} }

@ -32,6 +32,9 @@ struct delicious *skip_function_with_no_spec(void) {
} }
extern struct delicious *bakery(struct delicious **cake); extern struct delicious *bakery(struct delicious **cake);
extern struct delicious *bakery2(struct delicious **cake,
struct delicious **pie);
extern struct delicious *returnPassByRef();
struct delicious *skip_external_function(void) { struct delicious *skip_external_function(void) {
struct delicious *cake = NULL; struct delicious *cake = NULL;

Loading…
Cancel
Save