From: Arnaud Giersch Date: Tue, 6 Dec 2022 10:46:01 +0000 (+0100) Subject: Add -Wextra to CFLAGS too. X-Git-Tag: v3.34~668 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3c6276aa01e97101adf7ff78cab24c44ad2d48fc Add -Wextra to CFLAGS too. ... and fix associated warnings. --- diff --git a/examples/c/app-bittorrent/bittorrent-peer.c b/examples/c/app-bittorrent/bittorrent-peer.c index 2d5275c210..0ad57df9b2 100644 --- a/examples/c/app-bittorrent/bittorrent-peer.c +++ b/examples/c/app-bittorrent/bittorrent-peer.c @@ -254,7 +254,7 @@ int is_interested(const_peer_t peer, const_connection_t remote_peer) /** Indicates if the remote peer has a piece not stored by the local peer nor requested by the local peer */ int is_interested_and_free(const_peer_t peer, const_connection_t remote_peer) { - for (int i = 0; i < FILE_PIECES; i++) + for (unsigned int i = 0; i < FILE_PIECES; i++) if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i)) return 1; return 0; @@ -263,14 +263,14 @@ int is_interested_and_free(const_peer_t peer, const_connection_t remote_peer) /** @brief Updates the list of who has a piece from a bitfield */ void update_pieces_count_from_bitfield(const_peer_t peer, unsigned int bitfield) { - for (int i = 0; i < FILE_PIECES; i++) + for (unsigned int i = 0; i < FILE_PIECES; i++) if (bitfield & (1U << i)) peer->pieces_count[i]++; } -int count_pieces(unsigned int bitfield) +unsigned int count_pieces(unsigned int bitfield) { - int count = 0; + unsigned int count = 0; unsigned int n = bitfield; while (n) { count += n & 1U; @@ -424,7 +424,7 @@ void handle_message(peer_t peer, message_t message) break; case MESSAGE_HAVE: XBT_DEBUG("\t for piece %d", message->piece); - xbt_assert((message->piece >= 0 && message->piece < FILE_PIECES), "Wrong HAVE message received"); + xbt_assert((message->piece >= 0 && (unsigned)message->piece < FILE_PIECES), "Wrong HAVE message received"); remote_peer->bitfield = remote_peer->bitfield | (1U << message->piece); peer->pieces_count[message->piece]++; // If the piece is in our pieces, we tell the peer that we are interested. @@ -437,7 +437,7 @@ void handle_message(peer_t peer, message_t message) break; case MESSAGE_REQUEST: xbt_assert(remote_peer->interested); - xbt_assert((message->piece >= 0 && message->piece < FILE_PIECES), "Wrong request received"); + xbt_assert((message->piece >= 0 && (unsigned)message->piece < FILE_PIECES), "Wrong request received"); if (remote_peer->choked_upload == 0) { XBT_DEBUG("\t for piece %d (%d,%d)", message->piece, message->block_index, message->block_index + message->block_length); @@ -453,7 +453,7 @@ void handle_message(peer_t peer, message_t message) message->block_index + message->block_length); xbt_assert(!remote_peer->choked_download); xbt_assert(remote_peer->choked_download != 1, "Can't received a piece if I'm choked !"); - xbt_assert((message->piece >= 0 && message->piece < FILE_PIECES), "Wrong piece received"); + xbt_assert((message->piece >= 0 && (unsigned)message->piece < FILE_PIECES), "Wrong piece received"); // TODO: Execute a computation. if (peer_has_not_piece(peer, message->piece)) { update_bitfield_blocks(peer, message->piece, message->block_index, message->block_length); @@ -529,7 +529,7 @@ int select_piece_to_download(const_peer_t peer, const_connection_t remote_peer) (is_interested(peer, remote_peer) != 0)) { int nb_interesting_pieces = 0; // compute the number of interesting pieces - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i)) { nb_interesting_pieces++; } @@ -538,7 +538,7 @@ int select_piece_to_download(const_peer_t peer, const_connection_t remote_peer) // get a random interesting piece int random_piece_index = rand() % nb_interesting_pieces; int current_index = 0; - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i)) { if (random_piece_index == current_index) { piece = i; @@ -554,7 +554,7 @@ int select_piece_to_download(const_peer_t peer, const_connection_t remote_peer) if (count_pieces(peer->bitfield) < 4 && (is_interested_and_free(peer, remote_peer) != 0)) { int nb_interesting_pieces = 0; // compute the number of interesting pieces - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i)) { nb_interesting_pieces++; @@ -564,7 +564,7 @@ int select_piece_to_download(const_peer_t peer, const_connection_t remote_peer) // get a random interesting piece int random_piece_index = rand() % nb_interesting_pieces; int current_index = 0; - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i)) { if (random_piece_index == current_index) { @@ -581,14 +581,14 @@ int select_piece_to_download(const_peer_t peer, const_connection_t remote_peer) int nb_min_pieces = 0; int current_index = 0; // compute the smallest number of copies of available pieces - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer->pieces_count[i] < min && peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i)) min = peer->pieces_count[i]; } xbt_assert(min != SHRT_MAX || (is_interested_and_free(peer, remote_peer) == 0)); // compute the number of rarest pieces - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer->pieces_count[i] == min && peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i)) nb_min_pieces++; @@ -599,7 +599,7 @@ int select_piece_to_download(const_peer_t peer, const_connection_t remote_peer) if (nb_min_pieces > 0) { random_rarest_index = rand() % nb_min_pieces; } - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer->pieces_count[i] == min && peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i)) { if (random_rarest_index == current_index) { @@ -723,7 +723,7 @@ void update_interested_after_receive(const_peer_t peer) if (connection->am_interested != 0) { int interested = 0; // Check if the peer still has a piece we want. - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer_has_not_piece(peer, i) && connection_has_piece(connection, i)) { interested = 1; break; @@ -739,8 +739,8 @@ void update_interested_after_receive(const_peer_t peer) void update_bitfield_blocks(peer_t peer, int index, int block_index, int block_length) { - xbt_assert((index >= 0 && index <= FILE_PIECES), "Wrong piece."); - xbt_assert((block_index >= 0 && block_index <= PIECES_BLOCKS), "Wrong block : %d.", block_index); + xbt_assert((index >= 0 && (unsigned)index <= FILE_PIECES), "Wrong piece."); + xbt_assert((block_index >= 0 && (unsigned)block_index <= PIECES_BLOCKS), "Wrong block : %d.", block_index); for (int i = block_index; i < (block_index + block_length); i++) { peer->bitfield_blocks |= (1ULL << (unsigned int)(index * PIECES_BLOCKS + i)); } @@ -749,7 +749,7 @@ void update_bitfield_blocks(peer_t peer, int index, int block_index, int block_l /** Returns if a peer has completed the download of a piece */ int piece_complete(const_peer_t peer, int index) { - for (int i = 0; i < PIECES_BLOCKS; i++) { + for (unsigned int i = 0; i < PIECES_BLOCKS; i++) { if (!(peer->bitfield_blocks & 1ULL << (index * PIECES_BLOCKS + i))) { return 0; } @@ -760,7 +760,7 @@ int piece_complete(const_peer_t peer, int index) /** Returns the first block that a peer doesn't have in a piece. If the peer has all blocks of the piece, returns -1. */ int get_first_missing_block_from(const_peer_t peer, int piece) { - for (int i = 0; i < PIECES_BLOCKS; i++) { + for (unsigned int i = 0; i < PIECES_BLOCKS; i++) { if (!(peer->bitfield_blocks & 1ULL << (piece * PIECES_BLOCKS + i))) { return i; } @@ -771,7 +771,7 @@ int get_first_missing_block_from(const_peer_t peer, int piece) /** Returns a piece that is partially downloaded and stored by the remote peer if any -1 otherwise. */ int partially_downloaded_piece(const_peer_t peer, const_connection_t remote_peer) { - for (int i = 0; i < FILE_PIECES; i++) { + for (unsigned int i = 0; i < FILE_PIECES; i++) { if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i) && get_first_missing_block_from(peer, i) > 0) return i; diff --git a/examples/c/app-bittorrent/bittorrent-peer.h b/examples/c/app-bittorrent/bittorrent-peer.h index 70171a6702..9a7e290a77 100644 --- a/examples/c/app-bittorrent/bittorrent-peer.h +++ b/examples/c/app-bittorrent/bittorrent-peer.h @@ -73,7 +73,7 @@ int is_interested(const_peer_t peer, const_connection_t remote_peer); int is_interested_and_free(const_peer_t peer, const_connection_t remote_peer); void update_pieces_count_from_bitfield(const_peer_t peer, unsigned int bitfield); -int count_pieces(unsigned int bitfield); +unsigned int count_pieces(unsigned int bitfield); int nb_interested_peers(const_peer_t peer); void leech(peer_t peer); diff --git a/examples/c/app-token-ring/app-token-ring.c b/examples/c/app-token-ring/app-token-ring.c index 3eef350891..ab238d36e3 100644 --- a/examples/c/app-token-ring/app-token-ring.c +++ b/examples/c/app-token-ring/app-token-ring.c @@ -23,29 +23,29 @@ static void relay_runner(int argc, char* argv[]) xbt_assert(argc == 0, "The relay_runner function does not accept any parameter from the XML deployment file"); const char* name = sg_actor_self_get_name(); - int rank = (int)xbt_str_parse_int(name, "Any actor of this example must have a numerical name"); + unsigned rank = (unsigned)xbt_str_parse_int(name, "Any actor of this example must have a numerical name"); sg_mailbox_t my_mailbox = sg_mailbox_by_name(name); /* The last actor sends the token back to rank 0, the others send to their right neighbor (rank+1) */ char neighbor_mailbox_name[256]; - snprintf(neighbor_mailbox_name, 255, "%d", rank + 1 == sg_host_count() ? 0 : rank + 1); + snprintf(neighbor_mailbox_name, 255, "%u", rank + 1 == sg_host_count() ? 0 : rank + 1); sg_mailbox_t neighbor_mailbox = sg_mailbox_by_name(neighbor_mailbox_name); char* res; if (rank == 0) { /* The root actor (rank 0) first sends the token then waits to receive it back */ - XBT_INFO("Host \"%d\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox_name); + XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox_name); sg_mailbox_put(neighbor_mailbox, xbt_strdup("Token"), 1000000); res = (char*)sg_mailbox_get(my_mailbox); - XBT_INFO("Host \"%d\" received \"%s\"", rank, res); + XBT_INFO("Host \"%u\" received \"%s\"", rank, res); } else { /* The others actors receive from their left neighbor (rank-1) and send to their right neighbor (rank+1) */ res = (char*)sg_mailbox_get(my_mailbox); - XBT_INFO("Host \"%d\" received \"%s\"", rank, res); - XBT_INFO("Host \"%d\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox_name); + XBT_INFO("Host \"%u\" received \"%s\"", rank, res); + XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox_name); sg_mailbox_put(neighbor_mailbox, xbt_strdup("Token"), 1000000); } free(res); diff --git a/examples/c/dht-kademlia/node.c b/examples/c/dht-kademlia/node.c index d8204d35aa..c987618be7 100644 --- a/examples/c/dht-kademlia/node.c +++ b/examples/c/dht-kademlia/node.c @@ -156,7 +156,7 @@ void routing_table_update(const_node_t node, unsigned int id) // check if the id is already in the bucket. unsigned int id_pos = bucket_find_id(bucket, id); - if (id_pos == -1) { + if (id_pos == (unsigned int)-1) { /* We check if the bucket is full or not. If it is, we evict an old element */ if (xbt_dynar_length(bucket->nodes) >= BUCKET_SIZE) xbt_dynar_pop(bucket->nodes, NULL); diff --git a/examples/c/dht-pastry/dht-pastry.c b/examples/c/dht-pastry/dht-pastry.c index 2658603d6e..e9fbbf5ec9 100644 --- a/examples/c/dht-pastry/dht-pastry.c +++ b/examples/c/dht-pastry/dht-pastry.c @@ -265,7 +265,7 @@ static void handle_message(node_t node, pastry_message_t message) } node->namespace_set[NAMESPACE_SIZE / 2 + j] = message->sender_id; node->ready += message->steps + 1; - /* no break */ + /* fallthrough */ case JOIN_REPLY: XBT_DEBUG("Joining Reply"); @@ -520,7 +520,7 @@ int main(int argc, char* argv[]) char** options = &argv[1]; while (!strncmp(options[0], "-", 1)) { - int length = strlen("-nb_bits="); + size_t length = strlen("-nb_bits="); if (!strncmp(options[0], "-nb_bits=", length) && strlen(options[0]) > length) { nb_bits = (int)xbt_str_parse_int(options[0] + length, "Invalid nb_bits parameter"); XBT_DEBUG("Set nb_bits to %d", nb_bits); diff --git a/examples/c/io-disk-raw/io-disk-raw.c b/examples/c/io-disk-raw/io-disk-raw.c index e7902e2cd0..d19b251aa4 100644 --- a/examples/c/io-disk-raw/io-disk-raw.c +++ b/examples/c/io-disk-raw/io-disk-raw.c @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) size_t host_count = sg_host_count(); sg_host_t* hosts = sg_host_list(); - for (long i = 0; i < host_count; i++) { + for (size_t i = 0; i < host_count; i++) { XBT_INFO("*** %s properties ****", sg_host_get_name(hosts[i])); xbt_dict_t props = sg_host_get_properties(hosts[i]); xbt_dict_cursor_t cursor = NULL; diff --git a/examples/c/io-file-remote/io-file-remote.c b/examples/c/io-file-remote/io-file-remote.c index 003a10974f..7a9fadba48 100644 --- a/examples/c/io-file-remote/io-file-remote.c +++ b/examples/c/io-file-remote/io-file-remote.c @@ -53,7 +53,7 @@ int main(int argc, char** argv) size_t host_count = sg_host_count(); sg_host_t* hosts = sg_host_list(); - for (long i = 0; i < host_count; i++) { + for (size_t i = 0; i < host_count; i++) { unsigned int disk_count; sg_disk_t* disks; sg_host_get_disks(hosts[i], &disk_count, &disks); @@ -66,7 +66,7 @@ int main(int argc, char** argv) simgrid_run(); - for (long i = 0; i < host_count; i++) { + for (size_t i = 0; i < host_count; i++) { unsigned int disk_count; sg_disk_t* disks; sg_host_get_disks(hosts[i], &disk_count, &disks); diff --git a/examples/smpi/NAS/DGraph.c b/examples/smpi/NAS/DGraph.c index ad4f682106..452abc674d 100644 --- a/examples/smpi/NAS/DGraph.c +++ b/examples/smpi/NAS/DGraph.c @@ -54,7 +54,8 @@ DGraph* newDGraph(char* nm){ } int AttachNode(DGraph* dg, DGNode* nd) { - int i=0,j,len=0; + int i = 0, j; + unsigned len = 0; DGNode **nds =NULL, *tmpnd=NULL; DGArc **ar=NULL; diff --git a/src/xbt/mmalloc/mfree.c b/src/xbt/mmalloc/mfree.c index c6c5a84571..217743c8c6 100644 --- a/src/xbt/mmalloc/mfree.c +++ b/src/xbt/mmalloc/mfree.c @@ -21,7 +21,7 @@ void mfree(struct mdesc *mdp, void *ptr) { size_t frag_nb; size_t i; - int it; + size_t it; if (ptr == NULL) return; @@ -87,7 +87,7 @@ void mfree(struct mdesc *mdp, void *ptr) for (it=0; itheapinfo[block].busy_block.size; it++) { if (mdp->heapinfo[block+it].type < 0) { fprintf(stderr, - "Internal Error: Asked to free a block already marked as free (block=%zu it=%d type=%d). " + "Internal Error: Asked to free a block already marked as free (block=%zu it=%zu type=%d). " "Please report this bug.\n", block, it, mdp->heapinfo[block].type); abort(); @@ -108,7 +108,7 @@ void mfree(struct mdesc *mdp, void *ptr) for (it=0; itheapinfo[block].free_block.size; it++) { if (mdp->heapinfo[block+it].type <0) { fprintf(stderr, - "Internal error: Asked to free a block already marked as free (block=%zu it=%d/%zu type=%d). " + "Internal error: Asked to free a block already marked as free (block=%zu it=%zu/%zu type=%d). " "Please report this bug.\n", block, it, mdp->heapinfo[block].free_block.size, mdp->heapinfo[block].type); abort(); diff --git a/src/xbt/mmalloc/mmalloc.c b/src/xbt/mmalloc/mmalloc.c index be0070f87b..6bf8eace8c 100644 --- a/src/xbt/mmalloc/mmalloc.c +++ b/src/xbt/mmalloc/mmalloc.c @@ -119,7 +119,7 @@ static void *register_morecore(struct mdesc *mdp, size_t size) /* Update the swag of busy blocks containing free fragments by applying the offset to all swag_hooks. Yeah. My hand is right in the fan and I still type */ size_t offset=((char*)newinfo)-((char*)oldinfo); - for (int i = 1 /*first element of heapinfo describes the mdesc area*/; i < mdp->heaplimit; i++) { + for (size_t i = 1 /*first element of heapinfo describes the mdesc area*/; i < mdp->heaplimit; i++) { update_hook(&newinfo[i].freehook.next, offset); update_hook(&newinfo[i].freehook.prev, offset); } @@ -132,7 +132,7 @@ static void *register_morecore(struct mdesc *mdp, size_t size) /* mark the space previously occupied by the block info as free by first marking it * as occupied in the regular way, and then freing it */ - for (int it = 0; it < BLOCKIFY(mdp->heapsize * sizeof(malloc_info)); it++) { + for (size_t it = 0; it < BLOCKIFY(mdp->heapsize * sizeof(malloc_info)); it++) { newinfo[BLOCK(oldinfo)+it].type = MMALLOC_TYPE_UNFRAGMENTED; newinfo[BLOCK(oldinfo)+it].busy_block.ignore = 0; } @@ -160,7 +160,7 @@ void *mmalloc(xbt_mheap_t mdp, size_t size) { static void mmalloc_mark_used(xbt_mheap_t mdp, size_t block, size_t nblocks, size_t requested_size) { - for (int it = 0; it < nblocks; it++) { + for (size_t it = 0; it < nblocks; it++) { mdp->heapinfo[block + it].type = MMALLOC_TYPE_UNFRAGMENTED; mdp->heapinfo[block + it].busy_block.busy_size = 0; mdp->heapinfo[block + it].busy_block.ignore = 0; diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 5e380cc2ae..f13069519c 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -93,7 +93,7 @@ XBT_PRIVATE xbt_mheap_t mmalloc_preinit(void); /* Address to block number and vice versa. */ -#define BLOCK(A) (((char*) (A) - (char*) mdp -> heapbase) / BLOCKSIZE + 1) +#define BLOCK(A) ((size_t)(((char*)(A) - (char*)mdp->heapbase) / BLOCKSIZE + 1)) #define ADDRESS(B) ((void*) (((ADDR2UINT(B)) - 1) * BLOCKSIZE + (char*) mdp -> heapbase)) diff --git a/teshsuite/smpi/macro-partial-shared/macro-partial-shared.c b/teshsuite/smpi/macro-partial-shared/macro-partial-shared.c index 3de3103366..15be00d2df 100644 --- a/teshsuite/smpi/macro-partial-shared/macro-partial-shared.c +++ b/teshsuite/smpi/macro-partial-shared/macro-partial-shared.c @@ -37,7 +37,7 @@ static int check_all(const uint8_t* buf, size_t start, size_t stop, uint8_t valu // Return true iff "enough" elements are equal to (i+value)%256 between buf[start] and buf[stop-1]. static int check_enough(const uint8_t* buf, size_t start, size_t stop, uint8_t value) { - int page_size = 0x1000; + const unsigned int page_size = 0x1000; size_t size = stop-start; if(size <= 2*page_size) // we are not sure to have a whole page that is shared return 1; diff --git a/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt b/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt index d75ca355fc..2fa2e68284 100644 --- a/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt @@ -5,6 +5,8 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc") set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff") endif() + # There are too many warnings with these programs + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-sign-compare") include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") diff --git a/teshsuite/smpi/mpich3-test/coll/coll10.c b/teshsuite/smpi/mpich3-test/coll/coll10.c index d2a3981a80..95da8d9f0d 100644 --- a/teshsuite/smpi/mpich3-test/coll/coll10.c +++ b/teshsuite/smpi/mpich3-test/coll/coll10.c @@ -9,8 +9,6 @@ #define BAD_ANSWER 100000 -int assoc(int *, int *, int *, MPI_Datatype *); - /* The operation is inoutvec[i] = invec[i] op inoutvec[i] (see 4.9.4). The order is important. @@ -18,7 +16,7 @@ int assoc(int *, int *, int *, MPI_Datatype *); Note that the computation is in process rank (in the communicator) order, independent of the root. */ -int assoc(int *invec, int *inoutvec, int *len, MPI_Datatype * dtype) +static void assoc(int *invec, int *inoutvec, int *len, MPI_Datatype *dtype) { int i; for (i = 0; i < *len; i++) { @@ -31,7 +29,6 @@ int assoc(int *invec, int *inoutvec, int *len, MPI_Datatype * dtype) else inoutvec[i] = invec[i]; } - return (1); } int main(int argc, char **argv) diff --git a/teshsuite/smpi/mpich3-test/coll/longuser.c b/teshsuite/smpi/mpich3-test/coll/longuser.c index aa6b9c6b25..dbd22f65b3 100644 --- a/teshsuite/smpi/mpich3-test/coll/longuser.c +++ b/teshsuite/smpi/mpich3-test/coll/longuser.c @@ -7,19 +7,17 @@ #include #include -int add(double *, double *, int *, MPI_Datatype *); /* * User-defined operation on a long value (tests proper handling of * possible pipelining in the implementation of reductions with user-defined * operations). */ -int add(double *invec, double *inoutvec, int *len, MPI_Datatype * dtype) +static void add(double *invec, double *inoutvec, int *len, MPI_Datatype *dtype) { int i, n = *len; for (i = 0; i < n; i++) { inoutvec[i] = invec[i] + inoutvec[i]; } - return 0; } int main(int argc, char **argv) diff --git a/teshsuite/smpi/mpich3-test/coll/scatter2.c b/teshsuite/smpi/mpich3-test/coll/scatter2.c index 96a55b0ce1..677d03fb48 100644 --- a/teshsuite/smpi/mpich3-test/coll/scatter2.c +++ b/teshsuite/smpi/mpich3-test/coll/scatter2.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) MPI_Type_vector(n, 1, stride, MPI_DOUBLE, &vec); MPI_Type_commit(&vec); MPI_Type_extent(vec, &vextent); - if (vextent != ((n - 1) * (MPI_Aint) stride + 1) * sizeof(double)) { + if (vextent != (MPI_Aint)(((n - 1) * stride + 1) * sizeof(double))) { err++; printf("Vector extent is %ld, should be %ld\n", (long) vextent, (long) (((n - 1) * stride + 1) * sizeof(double))); diff --git a/teshsuite/smpi/mpich3-test/coll/scatter3.c b/teshsuite/smpi/mpich3-test/coll/scatter3.c index 84e88bbcf4..12cbb472e0 100644 --- a/teshsuite/smpi/mpich3-test/coll/scatter3.c +++ b/teshsuite/smpi/mpich3-test/coll/scatter3.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) MPI_Type_vector(n, 1, stride, MPI_DOUBLE, &vec); MPI_Type_commit(&vec); MPI_Type_extent(vec, &vextent); - if (vextent != ((n - 1) * (MPI_Aint) stride + 1) * sizeof(double)) { + if (vextent != (MPI_Aint)(((n - 1) * stride + 1) * sizeof(double))) { errs++; printf("Vector extent is %ld, should be %ld\n", (long) vextent, (long) (((n - 1) * stride + 1) * sizeof(double))); diff --git a/teshsuite/smpi/mpich3-test/info/infovallen.c b/teshsuite/smpi/mpich3-test/info/infovallen.c index 39cf7070e4..cc3101f9ed 100644 --- a/teshsuite/smpi/mpich3-test/info/infovallen.c +++ b/teshsuite/smpi/mpich3-test/info/infovallen.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) errs++; printf("Incorrect value for key %s\n", keys[i]); } - if (strlen(value) != vallen) { + if ((int)strlen(value) != vallen) { errs++; printf("value_len returned %d but actual len is %d\n", vallen, (int) strlen(value)); } diff --git a/teshsuite/smpi/mpich3-test/io/hindexed_io.c b/teshsuite/smpi/mpich3-test/io/hindexed_io.c index 5f4e0446fc..98192f26a3 100644 --- a/teshsuite/smpi/mpich3-test/io/hindexed_io.c +++ b/teshsuite/smpi/mpich3-test/io/hindexed_io.c @@ -46,7 +46,7 @@ int main(int argc, char **argv) data = malloc(data_size); verify = malloc(data_size * BLK_COUNT + HEADER + PAD); - for (i = 0; i < data_size / sizeof(int); i++) + for (i = 0; i < (int)(data_size / sizeof(int)); i++) data[i] = i; MPI_Type_create_hindexed_block(BLK_COUNT, data_size, disp, MPI_BYTE, &file_type); diff --git a/tools/cmake/Flags.cmake b/tools/cmake/Flags.cmake index ba2e37fe70..c54473d05a 100644 --- a/tools/cmake/Flags.cmake +++ b/tools/cmake/Flags.cmake @@ -14,7 +14,7 @@ set(optCFLAGS "") set(warnCXXFLAGS "") if(enable_compile_warnings) - set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing") + set(warnCFLAGS "-fno-common -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing") if(CMAKE_COMPILER_IS_GNUCC) set(warnCFLAGS "${warnCFLAGS} -Wclobbered -Wformat-signedness -Wno-error=clobbered -Wno-unused-local-typedefs -Wno-error=attributes -Wno-error=maybe-uninitialized") endif()