parted/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch

105 lines
3.3 KiB
Diff

From 34347779d3235186a68a040d3f3166ff45e65dac Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:20 +0900
Subject: [PATCH 21/42] libparted: Fix warnings from GCC 8
-Wsuggest-attribute=const
As GCC 8 suggests, add 'const' attribute to six functions. After adding
const attributes, GCC suggested two more functions to add const
attributes. Add const attributes to those functions also. In total, add
const attributes to 8 functions.
I read code of the functions and confirmed they are const: they examine
only their arguments and have no effect other than return value.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/r/fat/calc.c | 14 +++++++-------
libparted/fs/r/fat/table.c | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c
index 60c6bac..18e0455 100644
--- a/libparted/fs/r/fat/calc.c
+++ b/libparted/fs/r/fat/calc.c
@@ -23,7 +23,7 @@
#ifndef DISCOVER_ONLY
/* returns the minimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_min_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
@@ -33,7 +33,7 @@ fat_min_cluster_size (FatType fat_type) {
return 0;
}
-static PedSector
+static PedSector _GL_ATTRIBUTE_CONST
_smallest_power2_over (PedSector ceiling)
{
PedSector result = 1;
@@ -45,7 +45,7 @@ _smallest_power2_over (PedSector ceiling)
}
/* returns the minimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_recommend_min_cluster_size (FatType fat_type, PedSector size) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
@@ -59,7 +59,7 @@ fat_recommend_min_cluster_size (FatType fat_type, PedSector size) {
}
/* returns the maxmimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_max_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1; /* dunno... who cares? */
@@ -70,7 +70,7 @@ fat_max_cluster_size (FatType fat_type) {
}
/* returns the minimum number of clusters for a given file system type */
-FatCluster
+FatCluster _GL_ATTRIBUTE_CONST
fat_min_cluster_count (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12:
@@ -83,7 +83,7 @@ fat_min_cluster_count (FatType fat_type) {
}
/* returns the maximum number of clusters for a given file system type */
-FatCluster
+FatCluster _GL_ATTRIBUTE_CONST
fat_max_cluster_count (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 0xff0;
@@ -94,7 +94,7 @@ fat_max_cluster_count (FatType fat_type) {
}
/* what is this supposed to be? What drugs are M$ on? (Can I have some? :-) */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_min_reserved_sector_count (FatType fat_type)
{
return (fat_type == FAT_TYPE_FAT32) ? 32 : 1;
diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c
index 98b0499..394a519 100644
--- a/libparted/fs/r/fat/table.c
+++ b/libparted/fs/r/fat/table.c
@@ -462,7 +462,7 @@ fat_table_set_avail (FatTable* ft, FatCluster cluster)
#endif /* !DISCOVER_ONLY */
-int
+int _GL_ATTRIBUTE_CONST
fat_table_entry_size (FatType fat_type)
{
switch (fat_type) {
--
2.26.2