parted/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch

113 lines
3.8 KiB
Diff

From 8df7974ac36fcea82551c3f6990f981b659e2635 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Nov 2020 14:08:33 -0800
Subject: [PATCH 42/42] libparted/fs: Fix GCC warnings suggesting pure for
PED_ASSERT functions
There was some question about whether or not pure should be used for
functions with PED_ASSERT (or exit) in them. It should be fine, since
the values checked by the ASSERT are passed to the function directly.
Behavior should be exactly the same for the same inputs.
---
libparted/fs/r/fat/calc.c | 12 ++++++------
libparted/fs/r/fat/clstdup.c | 4 ++--
libparted/fs/r/hfs/cache.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c
index 18e0455..26c4d18 100644
--- a/libparted/fs/r/fat/calc.c
+++ b/libparted/fs/r/fat/calc.c
@@ -369,7 +369,7 @@ fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector)
+ fs_info->cluster_sectors * fs_info->cluster_count;
}
-FatFragment
+FatFragment _GL_ATTRIBUTE_PURE
fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -379,7 +379,7 @@ fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster)
return (cluster - 2) * fs_info->cluster_frags;
}
-FatCluster
+FatCluster _GL_ATTRIBUTE_PURE
fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -389,7 +389,7 @@ fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag)
return frag / fs_info->cluster_frags + 2;
}
-PedSector
+PedSector _GL_ATTRIBUTE_PURE
fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -399,7 +399,7 @@ fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag)
return frag * fs_info->frag_sectors + fs_info->cluster_offset;
}
-FatFragment
+FatFragment _GL_ATTRIBUTE_PURE
fat_sector_to_frag (const PedFileSystem* fs, PedSector sector)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -409,7 +409,7 @@ fat_sector_to_frag (const PedFileSystem* fs, PedSector sector)
return (sector - fs_info->cluster_offset) / fs_info->frag_sectors;
}
-PedSector
+PedSector _GL_ATTRIBUTE_PURE
fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -420,7 +420,7 @@ fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster)
+ fs_info->cluster_offset;
}
-FatCluster
+FatCluster _GL_ATTRIBUTE_PURE
fat_sector_to_cluster (const PedFileSystem* fs, PedSector sector)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
diff --git a/libparted/fs/r/fat/clstdup.c b/libparted/fs/r/fat/clstdup.c
index 7456f60..cfd1552 100644
--- a/libparted/fs/r/fat/clstdup.c
+++ b/libparted/fs/r/fat/clstdup.c
@@ -126,7 +126,7 @@ fetch_fragments (FatOpContext* ctx)
/* finds the first fragment that is not going to get overwritten (that needs to
get read in) */
-static FatFragment
+static FatFragment _GL_ATTRIBUTE_PURE
get_first_underlay (const FatOpContext* ctx, int first, int last)
{
int old;
@@ -147,7 +147,7 @@ get_first_underlay (const FatOpContext* ctx, int first, int last)
/* finds the last fragment that is not going to get overwritten (that needs to
get read in) */
-static FatFragment
+static FatFragment _GL_ATTRIBUTE_PURE
get_last_underlay (const FatOpContext* ctx, int first, int last)
{
int old;
diff --git a/libparted/fs/r/hfs/cache.c b/libparted/fs/r/hfs/cache.c
index 5e5b071..fc11fe9 100644
--- a/libparted/fs/r/hfs/cache.c
+++ b/libparted/fs/r/hfs/cache.c
@@ -173,7 +173,7 @@ hfsc_cache_add_extent(HfsCPrivateCache* cache, uint32_t start, uint32_t length,
return ext;
}
-HfsCPrivateExtent*
+HfsCPrivateExtent* _GL_ATTRIBUTE_PURE
hfsc_cache_search_extent(HfsCPrivateCache* cache, uint32_t start)
{
HfsCPrivateExtent* ret;
--
2.26.2