Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175060661
D25562.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D25562.diff
View Options
Index: sbin/newfs_msdos/mkfs_msdos.c
===================================================================
--- sbin/newfs_msdos/mkfs_msdos.c
+++ sbin/newfs_msdos/mkfs_msdos.c
@@ -43,6 +43,7 @@
#include <sys/stat.h>
#include <sys/time.h>
+#include <assert.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -78,12 +79,6 @@
#define MAXCLS16 0xfff4U /* maximum FAT16 clusters */
#define MAXCLS32 0xffffff4U /* maximum FAT32 clusters */
-#ifndef CTASSERT
-#define CTASSERT(x) _CTASSERT(x, __LINE__)
-#define _CTASSERT(x, y) __CTASSERT(x, y)
-#define __CTASSERT(x, y) typedef char __assert_ ## y [(x) ? 1 : -1]
-#endif
-
/*
* For better performance, we want to write larger chunks instead of
* individual sectors (the size can only be 512, 1024, 2048 or 4096
@@ -91,9 +86,9 @@
* sectors by asserting that both are power of two numbers and the
* MAXPHYS is greater than MAXBPS.
*/
-CTASSERT(powerof2(MAXPHYS));
-CTASSERT(powerof2(MAXBPS));
-CTASSERT(MAXPHYS > MAXBPS);
+static_assert(powerof2(MAXPHYS), "MAXPHYS is not power of 2");
+static_assert(powerof2(MAXBPS), "MAXBPS is not power of 2");
+static_assert(MAXPHYS > MAXBPS, "MAXPHYS is not greater than MAXBPS");
const static ssize_t chunksize = MAXPHYS;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 8, 11:48 PM (9 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40429276
Default Alt Text
D25562.diff (1 KB)
Attached To
Mode
D25562: Use static_assert.
Attached
Detach File
Event Timeline
Log In to Comment