[Bug 257450] MALLOC_DEFINE macro error in Freebsd13 OS
Date: Tue, 27 Jul 2021 13:12:29 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257450
Bug ID: 257450
Summary: MALLOC_DEFINE macro error in Freebsd13 OS
Product: Base System
Version: 13.0-STABLE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs@FreeBSD.org
Reporter: meetshamsher@gmail.com
# cat test.c
#include <sys/types.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/kthread.h>
#include <sys/unistd.h>
#include <stdlib.h>
MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
int main() {
int *ptr;
ptr = (int*)malloc(sizeof(int), M_NODE ,M_WAITOK)
printf("ptr=%p\n",ptr);
return 0;
}
# cc test.c
test.c:11:23: error: expected identifier
MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
^
test.c:11:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
^
test.c:14:37: error: use of undeclared identifier 'M_NODE'
ptr = (int*)malloc(sizeof(int), M_NODE ,M_WAITOK)
^
1 warning and 2 errors generated.
--
You are receiving this mail because:
You are the assignee for the bug.