Permalink
Browse files

Fixes EUCA-3902. Resolve compiler warning and improve makefile system

  • Loading branch information...
1 parent 30cfece commit 7d34b10d4ea87d83b262fb229e1ed08cef9b3af2 @gelinasc gelinasc committed Dec 27, 2012
Showing with 42 additions and 31 deletions.
  1. +1 −0 .cproject
  2. +3 −2 cluster/Makefile
  3. +3 −2 gatherlog/Makefile
  4. +5 −2 node/Makefile
  5. +3 −3 storage/Makefile
  6. +6 −4 storage/blobstore.c
  7. +11 −7 storage/vbr.c
  8. +1 −2 util/Makefile
  9. +1 −1 util/euca_mountwrap.c
  10. +1 −1 util/euca_string.c
  11. +1 −1 util/misc.c
  12. +4 −4 util/sensor.c
  13. +2 −2 util/utf8.c
View
@@ -43,6 +43,7 @@
<listOptionValue builtIn="false" value="__need_fd_set"/>
<listOptionValue builtIn="false" value="_UNIT_TEST"/>
<listOptionValue builtIn="false" value="DT_REG=8"/>
+ <listOptionValue builtIn="false" value="_DARWIN_C_SOURCE"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1809342783" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
View
@@ -70,6 +70,7 @@ SERVICE_SO=libEucalyptusCC.so
SERVICE_SO_FAKE=libEucalyptusCCFake.so
SERVICE_NAME=EucalyptusCC
CLIENT=CCclient
+GFLAGS=$(patsubst -Werror,,$(CFLAGS))
CLIENTKILLALL=euca_killall
SHUTDOWNCC=shutdownCC
#WSDL2C=${AXIS2C_HOME}/bin/tools/wsdl2c/WSDL2C.sh
@@ -103,12 +104,12 @@ generated/stubs: $(CCWSDL) $(NCWSDL)
@echo Compiling the stubs
patch --directory=generated -p1 <axis2_svc_generated.patch
@cp ../tools/Makefile.gen generated/Makefile
- $(MAKE) -C generated CFLAGS="$(CFLAGS) -Wno-unused-variable"
+ $(MAKE) -C generated CFLAGS="$(GFLAGS) -Wno-unused-variable"
@echo "this is a cute little makefile marker" >generated/stubs
@echo Stubs generated.
.c.o:
- $(CC) -c -O $(CFLAGS) $(INCLUDES) $<
+ $(CC) -c $(CFLAGS) $(INCLUDES) $<
../node/client-marshal-fake.o:
make -C ../node fake
View
@@ -67,6 +67,7 @@ GLWSDL=$(WSDLPATH)/$(GLWSDLNAME)
SERVICE_SO=libEucalyptusGL.so
SERVICE_NAME=EucalyptusGL
CLIENT=GLclient
+GFLAGS=$(patsubst -Werror,,$(CFLAGS))
#WSDL2C=$(AXIS2C_HOME)/bin/tools/wsdl2c/WSDL2C.sh
#server client
all: generated/stubs
@@ -87,12 +88,12 @@ generated/stubs: $(GLWSDL)
@echo Adding marshalling calls to server stubs
../tools/add_marshalling.pl generated/axis2_skel_*.c
@cp ../tools/Makefile.gen generated/Makefile
- $(MAKE) -C generated CFLAGS="$(CFLAGS) -Wno-unused-variable"
+ $(MAKE) -C generated CFLAGS="$(GFLAGS) -Wno-unused-variable"
@echo "this is a cute little makefile marker" >generated/stubs
@echo Stubs generated.
.c.o:
- $(CC) -c -O $(CFLAGS) $(INCLUDES) $<
+ $(CC) -c $(CFLAGS) $(INCLUDES) $<
server: $(SERVICE_SO)
View
@@ -71,6 +71,7 @@ NCWSDL=$(WSDLPATH)/$(NCWSDLNAME)
SERVICE_SO=libEucalyptusNC.so
SERVICE_NAME=EucalyptusNC
CLIENT=NCclient
+GFLAGS=$(patsubst -Werror,,$(CFLAGS))
#WSDL2C=$(AXIS2C_HOME)/bin/tools/wsdl2c/WSDL2C.sh
NC_LIBS = $(LIBS) $(LDFLAGS) -lvirt -lcurl -lssl -lcrypto -lrampart `xslt-config --libs`
AXIOM_LIBS = -lrampart -laxis2_http_sender -laxis2_http_receiver -laxis2_http_common -laxis2_engine -laxis2_axiom -laxutil -lneethi
@@ -101,13 +102,13 @@ generated/stubs: $(NCWSDL)
@echo Compiling the stubs
patch --directory=generated -p1 <axis2_svc_generated.patch
@cp ../tools/Makefile.gen generated/Makefile
- $(MAKE) -C generated CFLAGS="$(CFLAGS) -Wno-unused-variable"
+ $(MAKE) -C generated CFLAGS="$(GFLAGS) -Wno-unused-variable"
cd ..
@echo "this is a cute little makefile marker" >generated/stubs
@echo Stubs generated.
.c.o:
- $(CC) $(BUILD_ID) -c -O $(CFLAGS) `xslt-config --cflags` $(INCLUDES) $<
+ $(CC) -c $(BUILD_ID) $(CFLAGS) `xslt-config --cflags` $(INCLUDES) $<
server: $(SERVICE_SO)
@@ -215,6 +216,8 @@ indent:
done
clean:
+ @echo "GFLAGS: $(GFLAGS)"
+ @echo "CFLAGS: $(CFLAGS)"
rm -rf $(SERVICE_SO) *.o $(CLIENT) $(CLIENT)_local *~* *#* test_xml
distclean:
View
@@ -82,16 +82,16 @@ Wclient: Makefile Wclient.c $(WCLIENT_OBJS)
$(CC) $(CFLAGS) $(INCLUDES) Wclient.c -o Wclient $(WCLIENT_OBJS) $(STORAGE_LIBS) $(EFENCE)
test_blobstore: blobstore.o $(TEST_BLOB_OBJS)
- $(CC) -g -rdynamic $(CFLAGS) $(INCLUDES) -D_UNIT_TEST blobstore.c -o test_blobstore $(TEST_BLOB_OBJS) $(STORAGE_LIBS) $(EFENCE)
+ $(CC) -rdynamic $(CFLAGS) $(INCLUDES) -D_UNIT_TEST blobstore.c -o test_blobstore $(TEST_BLOB_OBJS) $(STORAGE_LIBS) $(EFENCE)
test_vbr: vbr.o $(TEST_VBR_OBJS)
- $(CC) -g -rdynamic $(CFLAGS) $(INCLUDES) -D_UNIT_TEST vbr.c -o test_vbr $(TEST_VBR_OBJS) $(STORAGE_LIBS) $(EFENCE)
+ $(CC) -rdynamic $(CFLAGS) $(INCLUDES) -D_UNIT_TEST vbr.c -o test_vbr $(TEST_VBR_OBJS) $(STORAGE_LIBS) $(EFENCE)
test_url: http.c
$(CC) -D_UNIT_TEST -o test_url http.c
%.o: %.c %.h
- $(CC) -c -O $(CFLAGS) $(INCLUDES) $<
+ $(CC) -c $(CFLAGS) $(INCLUDES) $<
../util/ipc.o: ../util/ipc.c ../util/ipc.h ../util/eucalyptus.h
make -C ../util
View
@@ -4628,15 +4628,17 @@ static int do_clone_stresstest(const char *base, const char *name, blobstore_for
blobstore_snapshot_t snapshot)
{
int errors = 0;
+ blobstore *bs1 = NULL;
+ blobstore *bs2 = NULL;
+
printf("commencing cloning stress-test...\n");
- blobstore *bs1 = create_teststore(STRESS_BS_SIZE, base, name, BLOBSTORE_FORMAT_DIRECTORY, BLOBSTORE_REVOCATION_NONE, BLOBSTORE_SNAPSHOT_DM);
- if (bs1 == NULL) {
+ if ((bs1 = create_teststore(STRESS_BS_SIZE, base, name, BLOBSTORE_FORMAT_DIRECTORY, BLOBSTORE_REVOCATION_NONE, BLOBSTORE_SNAPSHOT_DM)) == NULL) {
errors++;
goto done;
}
- blobstore *bs2 = create_teststore(STRESS_BS_SIZE, base, name, BLOBSTORE_FORMAT_DIRECTORY, BLOBSTORE_REVOCATION_LRU, BLOBSTORE_SNAPSHOT_DM);
- if (bs2 == NULL) {
+
+ if ((bs2 = create_teststore(STRESS_BS_SIZE, base, name, BLOBSTORE_FORMAT_DIRECTORY, BLOBSTORE_REVOCATION_LRU, BLOBSTORE_SNAPSHOT_DM)) == NULL) {
errors++;
goto done;
}
View
@@ -534,7 +534,7 @@ static int parse_rec(virtualBootRecord * vbr, virtualMachine * vm, ncMetadata *
return EUCA_ERROR;
}
- int letters_len = 3; // e.g. "sda"
+ size_t letters_len = 3; // e.g. "sda"
if (t == 'x')
letters_len = 4; // e.g., "xvda"
if (t == 'f')
@@ -1479,7 +1479,7 @@ void art_free(artifact * a)
//!
void arts_free(artifact * array[], unsigned int array_len)
{
- int i = 0;
+ u_int i = 0;
if (array) {
for (i = 0; i < array_len; i++)
ART_FREE(array[i]);
@@ -1568,15 +1568,19 @@ boolean tree_uses_cache(artifact * a)
//!
static int art_gen_id(char *buf, unsigned int buf_size, const char *first, const char *sig)
{
- char hash[48];
+ int bytesWritten = 0;
+ char hash[48] = "";
if (hexjenkins(hash, sizeof(hash), sig) != EUCA_OK)
- return EUCA_ERROR;
+ return (EUCA_ERROR);
- if (snprintf(buf, buf_size, "%s-%s", first, hash) >= buf_size) // truncation
- return EUCA_ERROR;
+ if((bytesWritten = snprintf(buf, buf_size, "%s-%s", first, hash)) < 0)
+ return (EUCA_ERROR);
- return EUCA_OK;
+ if (((unsigned) bytesWritten) >= buf_size) // truncation
+ return (EUCA_ERROR);
+
+ return (EUCA_OK);
}
//!
View
@@ -64,7 +64,6 @@ include ../Makedefs
EFENCE=-lefence
#DEBUGS = -DDEBUG # -DDEBUG1
-CC += -g
all: euca_string.o utf8.o log.o config.o fault.o misc.o wc.o hash.o data.o sensor.o euca_auth.o euca_axis.o ipc.o windows-bundle.o euca_rootwrap euca_mountwrap euca-generate-fault
build: all
@@ -97,7 +96,7 @@ test_sensor: sensor.c sensor.h misc.o euca_string.o log.o ipc.o ../storage/disku
make -C ../storage
%.o: %.c %.h
- $(CC) -c -O -std=gnu99 $(CFLAGS) $(INCLUDES) $(DEBUGS) `xslt-config --cflags` $<
+ $(CC) -c $(CFLAGS) $(INCLUDES) $(DEBUGS) `xslt-config --cflags` $<
indent:
@for idfile in *.[ch]; do \
View
@@ -166,7 +166,7 @@ int main(int argc, char **argv);
//!
int main(int argc, char **argv)
{
- int i = 0;
+ u_int i = 0;
int rc = 0;
uid_t uid = 0;
char *source = NULL;
View
@@ -396,7 +396,7 @@ long long euca_strtoll(const char *string, const char *begin, const char *end)
char *euca_strduptolower(const char *restrict string)
{
char *lc = NULL;
- register int i = 0;
+ register size_t i = 0;
register size_t len = 0;
// Was str provided?
View
@@ -1644,8 +1644,8 @@ char *file2str(const char *path)
int bytes_total = 0;
int to_read = 0;
char *p = NULL;
- int file_size = 0;
char *content = NULL;
+ off_t file_size = 0;
struct stat mystat = { 0 };
if (stat(path, &mystat) < 0) {
View
@@ -235,7 +235,7 @@ static void log_sensor_resources(const char *name, sensorResource ** srs, int sr
#endif /* _UNIT_TEST */
static sensorResource *find_or_alloc_sr(const boolean do_alloc, const char *resourceName, const char *resourceType, const char *resourceUuid);
static sensorMetric *find_or_alloc_sm(const boolean do_alloc, sensorResource * sr, const char *metricName);
-static sensorCounter *find_or_alloc_sc(const boolean do_alloc, sensorMetric * sm, const int counterType);
+static sensorCounter *find_or_alloc_sc(const boolean do_alloc, sensorMetric * sm, const sensorCounterType counterType);
static sensorDimension *find_or_alloc_sd(const boolean do_alloc, sensorCounter * sc, const char *dimensionName);
#ifdef _UNIT_TEST
@@ -828,7 +828,7 @@ int sensor_get_num_resources(void)
//!
sensorCounterType sensor_str2type(const char *counterType)
{
- for (int i = 0; i < (sizeof(sensorCounterTypeName) / sizeof(char *)); i++) {
+ for (u_int i = 0; i < (sizeof(sensorCounterTypeName) / sizeof(char *)); i++) {
if (strcmp(sensorCounterTypeName[i], counterType) == 0)
return i;
}
@@ -845,7 +845,7 @@ sensorCounterType sensor_str2type(const char *counterType)
//!
const char *sensor_type2str(sensorCounterType type)
{
- if ((type >= 0) && (type < (sizeof(sensorCounterTypeName) / sizeof(char *))))
+ if ((((signed) type) >= 0) && (type < (sizeof(sensorCounterTypeName) / sizeof(char *))))
return (sensorCounterTypeName[type]);
return ("[invalid]");
}
@@ -1127,7 +1127,7 @@ static sensorMetric *find_or_alloc_sm(const boolean do_alloc, sensorResource * s
//!
//! @return a pointer to the sensor counter or NULL on failure
//!
-static sensorCounter *find_or_alloc_sc(const boolean do_alloc, sensorMetric * sm, const int counterType)
+static sensorCounter *find_or_alloc_sc(const boolean do_alloc, sensorMetric * sm, const sensorCounterType counterType)
{
// sanity check
if (sm->countersLen < 0 || sm->countersLen > MAX_SENSOR_COUNTERS) {
View
@@ -271,7 +271,7 @@ size_t utf8_to_wchar(const char *in, size_t insize, wchar_t * out, size_t outsiz
}
// does the sequence header tell us truth about length?
- if ((lim - p) <= (n - 1)) {
+ if (((signed)(lim - p)) <= ((signed)(n - 1))) {
if ((flags & UTF8_IGNORE_ERROR) == 0)
return (0);
n = 1;
@@ -396,7 +396,7 @@ size_t wchar_to_utf8(const wchar_t * in, size_t insize, char *out, size_t outsiz
if (out == NULL)
continue;
- if ((lim - p) <= (n - 1))
+ if (((signed)(lim - p)) <= ((signed)(n - 1)))
return (0); // no space left
/* make it work under different endians */

0 comments on commit 7d34b10

Please sign in to comment.