Updating to the latest gnulib required some work: Jim Meyering (7): tests: two more of these: use "compare exp out", not "compare out exp" build: tweak how bootstrap manages ChangeLog build: avoid new float-to-double warnings build: mark functions with "const" or "pure" attribute, per gcc warnings build: configure.ac: use -Wno-format-nonliteral build: address a new "noreturn" suggestion build: update gnulib submodule to latest
bootstrap.conf | 7 +--- configure.ac | 2 +- gnulib | 2 +- include/parted/constraint.h | 2 +- include/parted/crc32.h | 2 +- include/parted/device.h | 4 +- include/parted/disk.h | 37 +++++++++++++++-------- include/parted/exception.h | 9 ++++-- include/parted/filesys.h | 6 ++- include/parted/geom.h | 11 ++++--- include/parted/natmath.h | 20 +++++++----- include/parted/parted.h | 2 +- include/parted/unit.h | 5 ++- libparted/arch/linux.c | 6 ++-- libparted/cs/natmath.c | 4 +- libparted/disk.c | 6 ++-- libparted/exception.c | 3 +- libparted/fs/amiga/amiga.h | 2 +- libparted/labels/aix.c | 8 ++-- libparted/labels/bsd.c | 2 +- libparted/labels/dos.c | 24 +++++++------- libparted/labels/dvh.c | 4 +- libparted/labels/efi_crc32.c | 2 +- libparted/labels/gpt.c | 4 +- libparted/labels/mac.c | 8 ++-- libparted/labels/pc98.c | 10 +++--- libparted/labels/rdb.c | 8 ++-- libparted/labels/sun.c | 2 +- libparted/tests/common.h | 2 +- libparted/timer.c | 4 +- libparted/unit.c | 7 ++-- parted/parted.c | 2 +- parted/strlist.c | 4 +- parted/strlist.h | 2 +- parted/ui.c | 4 +- parted/ui.h | 4 +- tests/t2310-dos-extended-2-sector-min-offset.sh | 2 +- tests/t7000-scripting.sh | 2 +- 38 files changed, 128 insertions(+), 107 deletions(-) -- 1.7.8.rc4 >From 4af374a944a8d3cb71921e4804ad473ac1361d9c Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 15:36:36 +0100 Subject: [PATCH 1/7] tests: two more of these: use "compare exp out", not "compare out exp" * tests/t7000-scripting.sh: Reverse compare arguments. * tests/t2310-dos-extended-2-sector-min-offset.sh: Likewise. --- tests/t2310-dos-extended-2-sector-min-offset.sh | 2 +- tests/t7000-scripting.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh index aa05099..a4b4325 100644 --- a/tests/t2310-dos-extended-2-sector-min-offset.sh +++ b/tests/t2310-dos-extended-2-sector-min-offset.sh @@ -52,7 +52,7 @@ compare /dev/null out || fail=1 # Provoke a failure by trying to create a partition that starts just # one sector after the start of the extended partition. parted --align=min -s $scsi_dev mkpart logical 65s 128s > err 2>&1 && fail=1 -compare err err.exp || fail=1 +compare err.exp err || fail=1 # The above failed, but created the partition nonetheless. Remove it. parted -s $scsi_dev rm 5 || fail=1 diff --git a/tests/t7000-scripting.sh b/tests/t7000-scripting.sh index 1b93a58..032b3d5 100755 --- a/tests/t7000-scripting.sh +++ b/tests/t7000-scripting.sh @@ -52,7 +52,7 @@ for mkpart in mkpart; do # Compare the real error and the expected one normalize_part_diag_ out || fail=1 - compare out err.expected || fail=1 + compare err.expected out || fail=1 # Test mkpart interactive mode. # Create the test file -- 1.7.8.rc4 >From a3b50eb9a85dd9f10edf26925fd246a49abbac0a Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 15:35:12 +0100 Subject: [PATCH 2/7] build: tweak how bootstrap manages ChangeLog * bootstrap.conf: Create ChangeLog only by touching it, so that it doesn't ever remove my in-use symlink (w/vc-dwim). --- bootstrap.conf | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 14123a2..2b3fd3a 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -141,10 +141,7 @@ rsync - tar - " -# If there is no ChangeLog file, create it. -if test -d .git; then - test -e ChangeLog || - git log --pretty=medium | fold -s > ChangeLog -fi +# Automake requires that ChangeLog exist. +touch ChangeLog || exit 1 gnulib_name=libgnulib -- 1.7.8.rc4 >From e9584920f6fe74545be7bced530774ebde624572 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 14:28:41 +0100 Subject: [PATCH 3/7] build: avoid new float-to-double warnings * libparted/timer.c (ped_timer_new_nested): Mark literal floating point constants with "f" suffix, since they are compared against "float"s. * parted/parted.c (_timer_handler): Likewise. --- libparted/timer.c | 4 ++-- parted/parted.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libparted/timer.c b/libparted/timer.c index d12b801..3b51b32 100644 --- a/libparted/timer.c +++ b/libparted/timer.c @@ -127,8 +127,8 @@ ped_timer_new_nested (PedTimer* parent, float nest_frac) if (!parent) return NULL; - PED_ASSERT (nest_frac >= 0.0); - PED_ASSERT (nest_frac <= 1.0); + PED_ASSERT (nest_frac >= 0.0f); + PED_ASSERT (nest_frac <= 1.0f); context = (NestedContext*) ped_malloc (sizeof (NestedContext)); if (!context) diff --git a/parted/parted.c b/parted/parted.c index 66beba6..98524cc 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -204,7 +204,7 @@ _timer_handler (PedTimer* timer, void* context) if (timer->state_name) printf ("%s... ", timer->state_name); printf (_("%0.f%%\t(time left %.2d:%.2d)"), - 100.0 * timer->frac, + (double) (100.0f * timer->frac), (int) (tcontext->predicted_time_left / 60), (int) (tcontext->predicted_time_left % 60)); -- 1.7.8.rc4 >From e2554c4ce2987a9c7f9dfdbce5a5dde5542c0b65 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 14:57:26 +0100 Subject: [PATCH 4/7] build: mark functions with "const" or "pure" attribute, per gcc warnings Use _GL_ATTRIBUTE_PURE or _GL_ATTRIBUTE_CONST. Mark static functions at point of definition; extern ones at point of declaration. * include/parted/crc32.h: * include/parted/device.h: Likewise. * include/parted/disk.h: Likewise. * include/parted/exception.h: Likewise. * include/parted/filesys.h: Likewise. * include/parted/geom.h: Likewise. * include/parted/natmath.h: Likewise. * include/parted/parted.h: Likewise. * include/parted/unit.h: Likewise. * libparted/arch/linux.c: Likewise. * libparted/disk.c: Likewise. * libparted/exception.c: Likewise. * libparted/fs/amiga/amiga.h: Likewise. * libparted/labels/aix.c: Likewise. * libparted/labels/bsd.c: Likewise. * libparted/labels/dos.c: Likewise. * libparted/labels/dvh.c: Likewise. * libparted/labels/efi_crc32.c: Likewise. * libparted/labels/gpt.c: Likewise. * libparted/labels/mac.c: Likewise. * libparted/labels/pc98.c: Likewise. * libparted/labels/rdb.c: Likewise. * libparted/labels/sun.c: Likewise. * libparted/unit.c: Likewise. * parted/ui.c: Likewise. * parted/strlist.c: Likewise. * parted/strlist.h: Likewise. * libparted/tests/common.h (_implemented_disk_label): Mark as pure. * libparted/cs/natmath.c (extended_euclid): Mark as pure. --- include/parted/constraint.h | 2 +- include/parted/crc32.h | 2 +- include/parted/device.h | 4 ++-- include/parted/disk.h | 37 ++++++++++++++++++++++++------------- include/parted/exception.h | 9 ++++++--- include/parted/filesys.h | 6 ++++-- include/parted/geom.h | 11 ++++++----- include/parted/natmath.h | 20 ++++++++++++-------- include/parted/parted.h | 2 +- include/parted/unit.h | 5 +++-- libparted/arch/linux.c | 6 +++--- libparted/cs/natmath.c | 4 ++-- libparted/disk.c | 6 +++--- libparted/exception.c | 3 ++- libparted/fs/amiga/amiga.h | 2 +- libparted/labels/aix.c | 8 ++++---- libparted/labels/bsd.c | 2 +- libparted/labels/dos.c | 24 ++++++++++++------------ libparted/labels/dvh.c | 4 ++-- libparted/labels/efi_crc32.c | 2 +- libparted/labels/gpt.c | 4 ++-- libparted/labels/mac.c | 8 ++++---- libparted/labels/pc98.c | 10 +++++----- libparted/labels/rdb.c | 8 ++++---- libparted/labels/sun.c | 2 +- libparted/tests/common.h | 2 +- libparted/unit.c | 7 ++++--- parted/strlist.c | 4 ++-- parted/strlist.h | 2 +- parted/ui.c | 4 ++-- parted/ui.h | 2 +- 31 files changed, 118 insertions(+), 94 deletions(-) diff --git a/include/parted/constraint.h b/include/parted/constraint.h index 4098835..a25689a 100644 --- a/include/parted/constraint.h +++ b/include/parted/constraint.h @@ -85,7 +85,7 @@ ped_constraint_solve_nearest ( extern int ped_constraint_is_solution (const PedConstraint* constraint, - const PedGeometry* geom); + const PedGeometry* geom) _GL_ATTRIBUTE_PURE; extern PedConstraint* ped_constraint_any (const PedDevice* dev); diff --git a/include/parted/crc32.h b/include/parted/crc32.h index 9d55723..0bdd879 100644 --- a/include/parted/crc32.h +++ b/include/parted/crc32.h @@ -29,6 +29,6 @@ */ extern uint32_t __efi_crc32 (const void *buf, unsigned long len, - uint32_t seed); + uint32_t seed) _GL_ATTRIBUTE_PURE; #endif /* _CRC32_H */ diff --git a/include/parted/device.h b/include/parted/device.h index d76854a..5d7562a 100644 --- a/include/parted/device.h +++ b/include/parted/device.h @@ -1,6 +1,6 @@ /* libparted - a library for manipulating disk partitions - Copyright (C) 1998 - 2001, 2005, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 1998-2001, 2005, 2007-2008, 2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -127,7 +127,7 @@ extern void ped_device_probe_all (); extern void ped_device_free_all (); extern PedDevice* ped_device_get (const char* name); -extern PedDevice* ped_device_get_next (const PedDevice* dev); +extern PedDevice* ped_device_get_next (const PedDevice* dev) _GL_ATTRIBUTE_PURE; extern int ped_device_is_busy (PedDevice* dev); extern int ped_device_open (PedDevice* dev); extern int ped_device_close (PedDevice* dev); diff --git a/include/parted/disk.h b/include/parted/disk.h index dd461fb..1113213 100644 --- a/include/parted/disk.h +++ b/include/parted/disk.h @@ -269,10 +269,13 @@ struct _PedDiskArchOps { extern void ped_disk_type_register (PedDiskType* type); extern void ped_disk_type_unregister (PedDiskType* type); -extern PedDiskType* ped_disk_type_get_next (PedDiskType const *type); -extern PedDiskType* ped_disk_type_get (const char* name); +extern PedDiskType* ped_disk_type_get_next (PedDiskType const *type) + _GL_ATTRIBUTE_PURE; +extern PedDiskType* ped_disk_type_get (const char* name) + _GL_ATTRIBUTE_PURE; extern int ped_disk_type_check_feature (const PedDiskType* disk_type, - PedDiskTypeFeature feature); + PedDiskTypeFeature feature) + _GL_ATTRIBUTE_PURE; extern PedDiskType* ped_disk_probe (PedDevice* dev); extern int ped_disk_clobber (PedDevice* dev); @@ -287,8 +290,10 @@ extern int ped_disk_commit_to_os (PedDisk* disk); extern int ped_disk_check (const PedDisk* disk); extern void ped_disk_print (const PedDisk* disk); -extern int ped_disk_get_primary_partition_count (const PedDisk* disk); -extern int ped_disk_get_last_partition_num (const PedDisk* disk); +extern int ped_disk_get_primary_partition_count (const PedDisk* disk) + _GL_ATTRIBUTE_PURE; +extern int ped_disk_get_last_partition_num (const PedDisk* disk) + _GL_ATTRIBUTE_PURE; extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk); extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk, int* supported); @@ -300,7 +305,7 @@ extern int ped_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag); extern const char *ped_disk_flag_get_name(PedDiskFlag flag); extern PedDiskFlag ped_disk_flag_get_by_name(const char *name); -extern PedDiskFlag ped_disk_flag_next(PedDiskFlag flag); +extern PedDiskFlag ped_disk_flag_next(PedDiskFlag flag) _GL_ATTRIBUTE_CONST; /** @} */ @@ -316,7 +321,7 @@ extern PedPartition* ped_partition_new (const PedDisk* disk, PedSector start, PedSector end); extern void ped_partition_destroy (PedPartition* part); -extern int ped_partition_is_active (const PedPartition* part); +extern int ped_partition_is_active (const PedPartition* part) _GL_ATTRIBUTE_PURE; extern int ped_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state); extern int ped_partition_get_flag (const PedPartition* part, @@ -330,10 +335,12 @@ extern const char* ped_partition_get_name (const PedPartition* part); extern int ped_partition_is_busy (const PedPartition* part); extern char* ped_partition_get_path (const PedPartition* part); -extern const char* ped_partition_type_get_name (PedPartitionType part_type); +extern const char* ped_partition_type_get_name (PedPartitionType part_type) + _GL_ATTRIBUTE_CONST; extern const char* ped_partition_flag_get_name (PedPartitionFlag flag); extern PedPartitionFlag ped_partition_flag_get_by_name (const char* name); -extern PedPartitionFlag ped_partition_flag_next (PedPartitionFlag flag); +extern PedPartitionFlag ped_partition_flag_next (PedPartitionFlag flag) + _GL_ATTRIBUTE_CONST; /** @} */ @@ -357,11 +364,15 @@ extern PedGeometry* ped_disk_get_max_partition_geometry (PedDisk* disk, extern int ped_disk_minimize_extended_partition (PedDisk* disk); extern PedPartition* ped_disk_next_partition (const PedDisk* disk, - const PedPartition* part); -extern PedPartition* ped_disk_get_partition (const PedDisk* disk, int num); + const PedPartition* part) + _GL_ATTRIBUTE_PURE; +extern PedPartition* ped_disk_get_partition (const PedDisk* disk, int num) + _GL_ATTRIBUTE_PURE; extern PedPartition* ped_disk_get_partition_by_sector (const PedDisk* disk, - PedSector sect); -extern PedPartition* ped_disk_extended_partition (const PedDisk* disk); + PedSector sect) + _GL_ATTRIBUTE_PURE; +extern PedPartition* ped_disk_extended_partition (const PedDisk* disk) + _GL_ATTRIBUTE_PURE; extern PedSector ped_disk_max_partition_length (const PedDisk *disk); extern PedSector ped_disk_max_partition_start_sector (const PedDisk *disk); diff --git a/include/parted/exception.h b/include/parted/exception.h index bfa6eb1..b1fb3ee 100644 --- a/include/parted/exception.h +++ b/include/parted/exception.h @@ -83,11 +83,14 @@ typedef PedExceptionOption (PedExceptionHandler) (PedException* ex); extern int ped_exception; /* set to true if there's an exception */ -extern char* ped_exception_get_type_string (PedExceptionType ex_type); -extern char* ped_exception_get_option_string (PedExceptionOption ex_opt); +extern char* ped_exception_get_type_string (PedExceptionType ex_type) + _GL_ATTRIBUTE_CONST; +extern char* ped_exception_get_option_string (PedExceptionOption ex_opt) + _GL_ATTRIBUTE_PURE; extern void ped_exception_set_handler (PedExceptionHandler* handler); -extern PedExceptionHandler *ped_exception_get_handler(void); +extern PedExceptionHandler *ped_exception_get_handler(void) + _GL_ATTRIBUTE_PURE; extern PedExceptionOption ped_exception_default_handler (PedException* ex); diff --git a/include/parted/filesys.h b/include/parted/filesys.h index 44258f5..3e20f6a 100644 --- a/include/parted/filesys.h +++ b/include/parted/filesys.h @@ -86,10 +86,12 @@ extern void ped_file_system_alias_unregister (PedFileSystemType* type, extern PedFileSystemType* ped_file_system_type_get (const char* name); extern PedFileSystemType* -ped_file_system_type_get_next (const PedFileSystemType* fs_type); +ped_file_system_type_get_next (const PedFileSystemType* fs_type) + _GL_ATTRIBUTE_PURE; extern PedFileSystemAlias* -ped_file_system_alias_get_next (const PedFileSystemAlias* fs_alias); +ped_file_system_alias_get_next (const PedFileSystemAlias* fs_alias) + _GL_ATTRIBUTE_PURE; extern PedFileSystemType* ped_file_system_probe (PedGeometry* geom); extern PedGeometry* ped_file_system_probe_specific ( diff --git a/include/parted/geom.h b/include/parted/geom.h index 0aea2b5..ee947ef 100644 --- a/include/parted/geom.h +++ b/include/parted/geom.h @@ -55,12 +55,13 @@ extern int ped_geometry_set (PedGeometry* geom, PedSector start, extern int ped_geometry_set_start (PedGeometry* geom, PedSector start); extern int ped_geometry_set_end (PedGeometry* geom, PedSector end); extern int ped_geometry_test_overlap (const PedGeometry* a, - const PedGeometry* b); + const PedGeometry* b) _GL_ATTRIBUTE_PURE; extern int ped_geometry_test_inside (const PedGeometry* a, - const PedGeometry* b); -extern int ped_geometry_test_equal (const PedGeometry* a, const PedGeometry* b); + const PedGeometry* b) _GL_ATTRIBUTE_PURE; +extern int ped_geometry_test_equal (const PedGeometry* a, const PedGeometry* b) + _GL_ATTRIBUTE_PURE; extern int ped_geometry_test_sector_inside (const PedGeometry* geom, - PedSector sect); + PedSector sect) _GL_ATTRIBUTE_PURE; extern int ped_geometry_read (const PedGeometry* geom, void* buffer, PedSector offset, PedSector count); @@ -78,7 +79,7 @@ extern int ped_geometry_sync_fast (PedGeometry* geom); /* returns -1 if "sector" is not within dest's space. */ extern PedSector ped_geometry_map (const PedGeometry* dst, const PedGeometry* src, - PedSector sector); + PedSector sector) _GL_ATTRIBUTE_PURE; #endif /* PED_GEOM_H_INCLUDED */ diff --git a/include/parted/natmath.h b/include/parted/natmath.h index 02c5ee8..a88ff06 100644 --- a/include/parted/natmath.h +++ b/include/parted/natmath.h @@ -58,10 +58,14 @@ struct _PedAlignment { PedSector grain_size; }; -extern PedSector ped_round_up_to (PedSector sector, PedSector grain_size); -extern PedSector ped_round_down_to (PedSector sector, PedSector grain_size); -extern PedSector ped_round_to_nearest (PedSector sector, PedSector grain_size); -extern PedSector ped_greatest_common_divisor (PedSector a, PedSector b); +extern PedSector ped_round_up_to (PedSector sector, PedSector grain_size) + _GL_ATTRIBUTE_CONST; +extern PedSector ped_round_down_to (PedSector sector, PedSector grain_size) + _GL_ATTRIBUTE_CONST; +extern PedSector ped_round_to_nearest (PedSector sector, PedSector grain_size) + _GL_ATTRIBUTE_CONST; +extern PedSector ped_greatest_common_divisor (PedSector a, PedSector b) + _GL_ATTRIBUTE_PURE; extern int ped_alignment_init (PedAlignment* align, PedSector offset, PedSector grain_size); @@ -73,17 +77,17 @@ extern PedAlignment* ped_alignment_intersect (const PedAlignment* a, extern PedSector ped_alignment_align_up (const PedAlignment* align, const PedGeometry* geom, - PedSector sector); + PedSector sector) _GL_ATTRIBUTE_PURE; extern PedSector ped_alignment_align_down (const PedAlignment* align, const PedGeometry* geom, - PedSector sector); + PedSector sector) _GL_ATTRIBUTE_PURE; extern PedSector ped_alignment_align_nearest (const PedAlignment* align, const PedGeometry* geom, - PedSector sector); + PedSector sector) _GL_ATTRIBUTE_PURE; extern int ped_alignment_is_aligned (const PedAlignment* align, const PedGeometry* geom, - PedSector sector); + PedSector sector) _GL_ATTRIBUTE_PURE; extern const PedAlignment* ped_alignment_any; extern const PedAlignment* ped_alignment_none; diff --git a/include/parted/parted.h b/include/parted/parted.h index f0e8847..7826330 100644 --- a/include/parted/parted.h +++ b/include/parted/parted.h @@ -37,7 +37,7 @@ extern "C" { #include <stdlib.h> #include <string.h> -extern const char* ped_get_version (); +extern const char* ped_get_version () _GL_ATTRIBUTE_CONST; extern void* ped_malloc (size_t size); extern void* ped_calloc (size_t size); diff --git a/include/parted/unit.h b/include/parted/unit.h index ceb53ac..d3296c3 100644 --- a/include/parted/unit.h +++ b/include/parted/unit.h @@ -65,8 +65,9 @@ typedef enum { #define PED_UNIT_LAST PED_UNIT_TEBIBYTE extern long long ped_unit_get_size (const PedDevice* dev, PedUnit unit); -extern const char* ped_unit_get_name (PedUnit unit); -extern PedUnit ped_unit_get_by_name (const char* unit_name); +extern const char *ped_unit_get_name (PedUnit unit) + _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_CONST; +extern PedUnit ped_unit_get_by_name (const char* unit_name) _GL_ATTRIBUTE_PURE; extern void ped_unit_set_default (PedUnit unit); extern PedUnit ped_unit_get_default (); diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index 1da3343..69878e3 100644 --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -2040,7 +2040,7 @@ _compare_digit_state (char ch, int need_digit) * Motivation: accept devices looking like /dev/rd/c0d0, but * not looking like /dev/hda1 and /dev/rd/c0d0p1 */ -static int +static int _GL_ATTRIBUTE_PURE _match_rd_device (const char* name) { const char* pos; @@ -2115,7 +2115,7 @@ struct _entry { size_t len; }; -static int +static int _GL_ATTRIBUTE_PURE _skip_entry (const char *name) { struct _entry *i; @@ -2314,7 +2314,7 @@ _partition_is_mounted (const PedPartition *part) return !!status; } -static int +static int _GL_ATTRIBUTE_PURE _has_partitions (const PedDisk* disk) { PED_ASSERT(disk != NULL); diff --git a/libparted/cs/natmath.c b/libparted/cs/natmath.c index 0294436..fe15a2e 100644 --- a/libparted/cs/natmath.c +++ b/libparted/cs/natmath.c @@ -196,7 +196,7 @@ ped_alignment_duplicate (const PedAlignment* align) * gcd = greatest common divisor of a and b * gcd = x*a + y*b */ -static EuclidTriple +static EuclidTriple _GL_ATTRIBUTE_PURE extended_euclid (int a, int b) { EuclidTriple result; @@ -340,7 +340,7 @@ ped_alignment_intersect (const PedAlignment* a, const PedAlignment* b) /* This function returns the sector closest to "sector" that lies inside * geom and satisfies the alignment constraint. */ -static PedSector +static PedSector _GL_ATTRIBUTE_PURE _closest_inside_geometry (const PedAlignment* align, const PedGeometry* geom, PedSector sector) { diff --git a/libparted/disk.c b/libparted/disk.c index 807b53a..e059a02 100644 --- a/libparted/disk.c +++ b/libparted/disk.c @@ -286,7 +286,7 @@ error: /* Given a partition table type NAME, e.g., "gpt", return its PedDiskType handle. If no known type has a name matching NAME, return NULL. */ -static PedDiskType const * +static PedDiskType const * _GL_ATTRIBUTE_PURE find_disk_type (char const *name) { PedDiskType const *t; @@ -1554,7 +1554,7 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part) /** @} */ #ifdef DEBUG -static int +static int _GL_ATTRIBUTE_PURE _disk_check_sanity (PedDisk* disk) { PedPartition* walk; @@ -1807,7 +1807,7 @@ _partition_get_overlap_constraint (PedPartition* part, PedGeometry* geom) * Note: overlap with an extended partition is also allowed, provided that * \p geom lies completely inside the extended partition. */ -static int +static int _GL_ATTRIBUTE_PURE _disk_check_part_overlaps (PedDisk* disk, PedPartition* part) { PedPartition* walk; diff --git a/libparted/exception.c b/libparted/exception.c index 910d25c..70086b6 100644 --- a/libparted/exception.c +++ b/libparted/exception.c @@ -52,6 +52,7 @@ #include <parted/parted.h> #include <parted/debug.h> +#include <parted/exception.h> #define N_(String) String #if ENABLE_NLS @@ -103,7 +104,7 @@ ped_exception_get_type_string (PedExceptionType ex_type) /* FIXME: move this out to the prospective math.c */ /* FIXME: this can probably be done more efficiently */ -static int +static int _GL_ATTRIBUTE_PURE ped_log2 (int n) { int x; diff --git a/libparted/fs/amiga/amiga.h b/libparted/fs/amiga/amiga.h index 3756020..39e4926 100644 --- a/libparted/fs/amiga/amiga.h +++ b/libparted/fs/amiga/amiga.h @@ -66,4 +66,4 @@ struct AmigaIds { struct AmigaIds * _amiga_add_id (uint32_t id, struct AmigaIds *ids); void _amiga_free_ids (struct AmigaIds *ids); -int _amiga_id_in_list (uint32_t id, struct AmigaIds *ids); +int _amiga_id_in_list (uint32_t id, struct AmigaIds *ids) _GL_ATTRIBUTE_PURE; diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c index 18d0f54..0dc25ce 100644 --- a/libparted/labels/aix.c +++ b/libparted/labels/aix.c @@ -167,7 +167,7 @@ aix_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) return 0; } -static int +static int _GL_ATTRIBUTE_CONST aix_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { return 0; @@ -195,7 +195,7 @@ aix_get_max_supported_partition_count (const PedDisk* disk, int *max_n) return true; } -static int +static int _GL_ATTRIBUTE_PURE aix_partition_align (PedPartition* part, const PedConstraint* constraint) { PED_ASSERT (part != NULL); @@ -203,13 +203,13 @@ aix_partition_align (PedPartition* part, const PedConstraint* constraint) return 1; } -static int +static int _GL_ATTRIBUTE_PURE aix_partition_enumerate (PedPartition* part) { return 1; } -static int +static int _GL_ATTRIBUTE_PURE aix_alloc_metadata (PedDisk* disk) { return 1; diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c index 2278a86..961c72a 100644 --- a/libparted/labels/bsd.c +++ b/libparted/labels/bsd.c @@ -494,7 +494,7 @@ bsd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) return 0; } -static int +static int _GL_ATTRIBUTE_PURE bsd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { BSDPartitionData* bsd_data; diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index 3d2dbd7..b69a71f 100644 --- a/libparted/labels/dos.c +++ b/libparted/labels/dos.c @@ -403,7 +403,7 @@ chs_get_sector (const RawCHS* chs) return (chs->sector & 0x3f) - 1; } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE chs_to_sector (const PedDevice* dev, const PedCHSGeometry *bios_geom, const RawCHS* chs) { @@ -452,7 +452,7 @@ sector_to_chs (const PedDevice* dev, const PedCHSGeometry* bios_geom, chs->sector = real_s + 1 + (real_c >> 8 << 6); } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE legacy_start (const PedDisk* disk, const PedCHSGeometry* bios_geom, const DosRawPartition* raw_part) { @@ -462,7 +462,7 @@ legacy_start (const PedDisk* disk, const PedCHSGeometry* bios_geom, return chs_to_sector (disk->dev, bios_geom, &raw_part->chs_start); } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE legacy_end (const PedDisk* disk, const PedCHSGeometry* bios_geom, const DosRawPartition* raw_part) { @@ -472,7 +472,7 @@ legacy_end (const PedDisk* disk, const PedCHSGeometry* bios_geom, return chs_to_sector (disk->dev, bios_geom, &raw_part->chs_end); } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE linear_start (const PedDisk* disk, const DosRawPartition* raw_part, PedSector offset) { @@ -482,7 +482,7 @@ linear_start (const PedDisk* disk, const DosRawPartition* raw_part, return offset + PED_LE32_TO_CPU (raw_part->start); } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE linear_end (const PedDisk* disk, const DosRawPartition* raw_part, PedSector offset) { @@ -494,7 +494,7 @@ linear_end (const PedDisk* disk, const DosRawPartition* raw_part, } #ifndef DISCOVER_ONLY -static int +static int _GL_ATTRIBUTE_PURE partition_check_bios_geometry (PedPartition* part, PedCHSGeometry* bios_geom) { PedSector leg_start, leg_end; @@ -520,7 +520,7 @@ partition_check_bios_geometry (PedPartition* part, PedCHSGeometry* bios_geom) return 1; } -static int +static int _GL_ATTRIBUTE_PURE disk_check_bios_geometry (const PedDisk* disk, PedCHSGeometry* bios_geom) { PedPartition* part = NULL; @@ -835,7 +835,7 @@ disk_probe_bios_geometry (const PedDisk* disk, PedCHSGeometry* bios_geom) } #endif /* !DISCOVER_ONLY */ -static int +static int _GL_ATTRIBUTE_PURE raw_part_is_extended (const DosRawPartition* raw_part) { PED_ASSERT (raw_part != NULL); @@ -853,7 +853,7 @@ raw_part_is_extended (const DosRawPartition* raw_part) return 0; } -static int +static int _GL_ATTRIBUTE_PURE raw_part_is_hidden (const DosRawPartition* raw_part) { PED_ASSERT (raw_part != NULL); @@ -875,7 +875,7 @@ raw_part_is_hidden (const DosRawPartition* raw_part) return 0; } -static int +static int _GL_ATTRIBUTE_PURE raw_part_is_lba (const DosRawPartition* raw_part) { PED_ASSERT (raw_part != NULL); @@ -1560,7 +1560,7 @@ msdos_partition_set_flag (PedPartition* part, } } -static int +static int _GL_ATTRIBUTE_PURE msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { DosPartitionData* dos_data; @@ -2401,7 +2401,7 @@ next_primary (const PedDisk* disk) return 0; } -static int +static int _GL_ATTRIBUTE_PURE next_logical (const PedDisk* disk) { int i; diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c index 8f4a208..dc114bf 100644 --- a/libparted/labels/dvh.c +++ b/libparted/labels/dvh.c @@ -156,7 +156,7 @@ dvh_free (PedDisk* disk) } /* two's complement 32-bit checksum */ -static uint32_t +static uint32_t _GL_ATTRIBUTE_PURE _checksum (const uint32_t* base, size_t size) { uint32_t sum = 0; @@ -656,7 +656,7 @@ dvh_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) return 1; } -static int +static int _GL_ATTRIBUTE_PURE dvh_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { DVHDiskData* dvh_disk_data = part->disk->disk_specific; diff --git a/libparted/labels/efi_crc32.c b/libparted/labels/efi_crc32.c index bf1249f..c25409f 100644 --- a/libparted/labels/efi_crc32.c +++ b/libparted/labels/efi_crc32.c @@ -108,7 +108,7 @@ static const uint32_t crc32_tab[] = { /* Return a 32-bit CRC of the contents of the buffer. */ -uint32_t +uint32_t _GL_ATTRIBUTE_PURE __efi_crc32(const void *buf, unsigned long len, uint32_t seed) { unsigned long i; diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 454a177..9d464c6 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -436,7 +436,7 @@ guid_cmp (efi_guid_t left, efi_guid_t right) } /* checks if 'mbr' is a protective MBR partition table */ -static inline int +static inline int _GL_ATTRIBUTE_PURE _pmbr_is_valid (const LegacyMBR_t *mbr) { int i; @@ -1628,7 +1628,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) return 1; } -static int +static int _GL_ATTRIBUTE_PURE gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) { GPTPartitionData *gpt_part_data; diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c index bd756c2..2ec6b8e 100644 --- a/libparted/labels/mac.c +++ b/libparted/labels/mac.c @@ -406,7 +406,7 @@ _rawpart_is_driver (const MacRawPartition* raw_part) return 1; } -static int +static int _GL_ATTRIBUTE_PURE _rawpart_has_driver (const MacRawPartition* raw_part, MacDiskData* mac_disk_data) { MacDeviceDriver *driverlist; @@ -1014,7 +1014,7 @@ _generate_empty_part (PedDisk* disk, int num, MacRawPartition* part_map) } /* returns the first empty entry in the partition map */ -static int +static int _GL_ATTRIBUTE_PURE _get_first_empty_part_entry (PedDisk* disk, MacRawPartition* part_map) { MacDiskData* mac_disk_data = disk->disk_specific; @@ -1292,7 +1292,7 @@ mac_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) } } -static int +static int _GL_ATTRIBUTE_PURE mac_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { MacPartitionData* mac_data; @@ -1369,7 +1369,7 @@ mac_partition_set_name (PedPartition* part, const char* name) mac_data->volume_name [i] = 0; } -static const char* +static const char* _GL_ATTRIBUTE_PURE mac_partition_get_name (const PedPartition* part) { MacPartitionData* mac_data; diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c index d60843d..df0e17a 100644 --- a/libparted/labels/pc98.c +++ b/libparted/labels/pc98.c @@ -193,7 +193,7 @@ pc98_free (PedDisk* disk) _ped_disk_free (disk); } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE chs_to_sector (const PedDevice* dev, int c, int h, int s) { PED_ASSERT (dev != NULL); @@ -217,7 +217,7 @@ sector_to_chs (const PedDevice* dev, PedSector sector, int* c, int* h, int* s) *s = (sector) % cyl_size % dev->hw_geom.sectors; } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE legacy_start (const PedDisk* disk, const PC98RawPartition* raw_part) { PED_ASSERT (disk != NULL); @@ -227,7 +227,7 @@ legacy_start (const PedDisk* disk, const PC98RawPartition* raw_part) raw_part->head, raw_part->sector); } -static PedSector +static PedSector _GL_ATTRIBUTE_PURE legacy_end (const PedDisk* disk, const PC98RawPartition* raw_part) { PED_ASSERT (disk != NULL); @@ -590,7 +590,7 @@ pc98_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) } } -static int +static int _GL_ATTRIBUTE_PURE pc98_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { PC98PartitionData* pc98_data; @@ -641,7 +641,7 @@ pc98_partition_set_name (PedPartition* part, const char* name) pc98_data->name [i] = 0; } -static const char* +static const char* _GL_ATTRIBUTE_PURE pc98_partition_get_name (const PedPartition* part) { PC98PartitionData* pc98_data; diff --git a/libparted/labels/rdb.c b/libparted/labels/rdb.c index 5db3787..5ceb00e 100644 --- a/libparted/labels/rdb.c +++ b/libparted/labels/rdb.c @@ -113,7 +113,7 @@ _amiga_free_ids (struct AmigaIds *ids) { free (current); } } -static int +static int _GL_ATTRIBUTE_PURE _amiga_id_in_list (uint32_t id, struct AmigaIds *ids) { struct AmigaIds *current; @@ -608,14 +608,14 @@ _amiga_find_free_blocks(const PedDisk *disk, uint32_t *table, } return 1; } -static uint32_t +static uint32_t _GL_ATTRIBUTE_PURE _amiga_next_free_block(uint32_t *table, uint32_t start, uint32_t type) { int i; for (i = start; table[i] != type && table[i] != IDNAME_FREE; i++); return i; } -static PedPartition * +static PedPartition * _GL_ATTRIBUTE_PURE _amiga_next_real_partition(const PedDisk *disk, PedPartition *part) { PedPartition *next; @@ -945,7 +945,7 @@ amiga_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) } } -static int +static int _GL_ATTRIBUTE_PURE amiga_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { struct PartitionBlock *partition; diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c index 6148273..20e61a0 100644 --- a/libparted/labels/sun.c +++ b/libparted/labels/sun.c @@ -650,7 +650,7 @@ sun_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) } -static int +static int _GL_ATTRIBUTE_PURE sun_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) { SunPartitionData* sun_data; diff --git a/libparted/tests/common.h b/libparted/tests/common.h index 8798ecb..1b1c801 100644 --- a/libparted/tests/common.h +++ b/libparted/tests/common.h @@ -18,7 +18,7 @@ PedDisk* _create_disk_label (PedDevice* dev, PedDiskType* type); * * label: disk label name */ -int _implemented_disk_label (const char* label); +int _implemented_disk_label (const char* label) _GL_ATTRIBUTE_PURE; /* Test specific exception handler * diff --git a/libparted/unit.c b/libparted/unit.c index 232f81b..8b1b517 100644 --- a/libparted/unit.c +++ b/libparted/unit.c @@ -52,6 +52,7 @@ #include <config.h> #include <parted/parted.h> #include <parted/debug.h> +#include <parted/unit.h> #include <ctype.h> #include <stdio.h> @@ -101,7 +102,7 @@ ped_unit_set_default (PedUnit unit) /** * \brief Get the current default unit. */ -PedUnit +PedUnit _GL_ATTRIBUTE_PURE ped_unit_get_default () { return default_unit; @@ -334,7 +335,7 @@ strip_string (char* str) /* Find non-number suffix. Eg: find_suffix("32Mb") returns a pointer to * "Mb". */ -static char* +static char* _GL_ATTRIBUTE_PURE find_suffix (const char* str) { while (str[0] != 0 && (isdigit (str[0]) || strchr(",.-", str[0]))) @@ -353,7 +354,7 @@ remove_punct (char* str) } } -static int +static int _GL_ATTRIBUTE_PURE is_chs (const char* str) { int punct_count = 0; diff --git a/parted/strlist.c b/parted/strlist.c index 46ef307..1ab9920 100644 --- a/parted/strlist.c +++ b/parted/strlist.c @@ -43,7 +43,7 @@ #define MIN(a,b) ( (a<b)? a : b ) -int +static int _GL_ATTRIBUTE_PURE wchar_strlen (const wchar_t* str) { #ifdef ENABLE_NLS @@ -53,7 +53,7 @@ wchar_strlen (const wchar_t* str) #endif } -wchar_t* +static wchar_t * _GL_ATTRIBUTE_PURE wchar_strchr (const wchar_t* str, char ch) { #ifdef ENABLE_NLS diff --git a/parted/strlist.h b/parted/strlist.h index 7fe9bf3..b90eee0 100644 --- a/parted/strlist.h +++ b/parted/strlist.h @@ -60,6 +60,6 @@ extern int str_list_match_any (const StrList* list, const char* str); extern int str_list_match_node (const StrList* list, const char* str); extern StrList* str_list_match (const StrList* list, const char* str); -extern int str_list_length (const StrList* list); +extern int str_list_length (const StrList* list) _GL_ATTRIBUTE_PURE; #endif /* STRLIST_H_INCLUDED */ diff --git a/parted/ui.c b/parted/ui.c index 1def754..f0d663e 100644 --- a/parted/ui.c +++ b/parted/ui.c @@ -592,7 +592,7 @@ _readline (const char* prompt, const StrList* possibilities) return line; } -static PedExceptionOption +static PedExceptionOption _GL_ATTRIBUTE_PURE option_get_next (PedExceptionOption options, PedExceptionOption current) { PedExceptionOption i; @@ -704,7 +704,7 @@ command_line_get_word_count () return str_list_length (command_line); } -static int +static int _GL_ATTRIBUTE_PURE _str_is_spaces (const char* str) { while (isspace (*str)) diff --git a/parted/ui.h b/parted/ui.h index 14ba380..15da2ee 100644 --- a/parted/ui.h +++ b/parted/ui.h @@ -43,7 +43,7 @@ extern void command_line_push_word (const char* word); extern char* command_line_pop_word (); extern char* command_line_peek_word (); extern void command_line_flush (); -extern int command_line_get_word_count (); +extern int command_line_get_word_count () _GL_ATTRIBUTE_PURE; extern void command_line_prompt_words (const char* prompt, const char* def, const StrList* possibilities, int multi_word); -- 1.7.8.rc4 >From 6f9977208a6a4453f60bc656419787060ceed903 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 15:16:16 +0100 Subject: [PATCH 5/7] build: configure.ac: use -Wno-format-nonliteral --- configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 3915ac0..b5f7abf 100644 --- a/configure.ac +++ b/configure.ac @@ -210,7 +210,6 @@ if test "$gl_gcc_warnings" = yes; then nw="$nw -Wpadded" # Our structs are not padded nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat nw="$nw -Wlogical-op" # any use of fwrite provokes this - nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses nw="$nw -Wvla" # warnings in gettext.h nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__ nw="$nw -Wswitch-enum" # Too many warnings for now @@ -242,6 +241,7 @@ if test "$gl_gcc_warnings" = yes; then gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now gl_WARN_ADD([-Wno-unused-macros]) # Too many warnings for now + gl_WARN_ADD([-Wno-format-nonliteral]) # FIXME: investigate these gl_WARN_ADD([-Wno-jump-misses-init]) -- 1.7.8.rc4 >From 407edb4c8b64bd7c69744db47bf505f73a5f2f35 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 15:24:35 +0100 Subject: [PATCH 6/7] build: address a new "noreturn" suggestion * parted/ui.h (help_msg): Declare as __noreturn__. --- parted/ui.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/parted/ui.h b/parted/ui.h index 15da2ee..23eb640 100644 --- a/parted/ui.h +++ b/parted/ui.h @@ -77,7 +77,7 @@ extern int command_line_get_align_type (const char *prompt, extern int command_line_is_integer (); extern int command_line_is_sector (); -extern void help_msg (); +extern void help_msg () __attribute__((__noreturn__)); extern void print_using_dev (PedDevice* dev); -- 1.7.8.rc4 >From bd4933328af72fa9fedefb2c6f5bbfed538c5392 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Sat, 3 Dec 2011 14:10:48 +0100 Subject: [PATCH 7/7] build: update gnulib submodule to latest --- gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gnulib b/gnulib index 44e24aa..26d77b2 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 44e24aa42fb9e808f25767f5ce555d6844efc1c8 +Subproject commit 26d77b259a32a4ed190886bc82715afed2ea70a1 -- 1.7.8.rc4