- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚将我的项目上传到github: https://github.com/gitlwh/whyisthis/tree/master
您可以克隆它并在 Mac 上运行。这很方便。当我在根文件夹中运行 make
时,它显示:
uthread.c:21:3: warning: implicit declaration of function ‘swapcontext’ [-Wimplicit-function-declaration]
swapcontext(¤tThread->context,&scheduler_context);
^
uthread.c: In function ‘main_manager’:
uthread.c:31:2: warning: implicit declaration of function ‘setcontext’ [-Wimplicit-function-declaration]
setcontext(&mainThread->context);
^
uthread.c: In function ‘initialer’:
uthread.c:72:5: warning: implicit declaration of function ‘getcontext’ [-Wimplicit-function-declaration]
getcontext(&initThread->context);
^
uthread.c: In function ‘THREAD_INIT’:
uthread.c:112:3: warning: implicit declaration of function ‘makecontext’ [-Wimplicit-function-declaration]
makecontext(&mainThread->context, (void(*)(void)) main_manager, 0, NULL, NULL);
^
我在网上查找了很多资料,并用 sys/ucontext.h 替换了 ucontext.h。我实在不知道这是为什么。
更新:如果我更改为 ucontext.h,它将显示:
uthread.c: In function ‘signal_handler’:
uthread.c:21:3: warning: ‘swapcontext’ is deprecated [-Wdeprecated-declarations]
swapcontext(¤tThread->context,&scheduler_context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:40:6: note: declared here
int swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘main_manager’:
uthread.c:31:2: warning: ‘setcontext’ is deprecated [-Wdeprecated-declarations]
setcontext(&mainThread->context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:39:6: note: declared here
int setcontext(const ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c:32:2: warning: ‘setcontext’ is deprecated [-Wdeprecated-declarations]
setcontext(&scheduler_context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:39:6: note: declared here
int setcontext(const ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘thread_manager’:
uthread.c:43:2: warning: ‘setcontext’ is deprecated [-Wdeprecated-declarations]
setcontext(&scheduler_context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:39:6: note: declared here
int setcontext(const ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘scheduler’:
uthread.c:55:9: warning: ‘swapcontext’ is deprecated [-Wdeprecated-declarations]
swapcontext(&scheduler_context,¤tThread->context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:40:6: note: declared here
int swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘initialer’:
uthread.c:72:5: warning: ‘getcontext’ is deprecated [-Wdeprecated-declarations]
getcontext(&initThread->context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:37:6: note: declared here
int getcontext(ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘THREAD_INIT’:
uthread.c:112:3: warning: ‘makecontext’ is deprecated [-Wdeprecated-declarations]
makecontext(&mainThread->context, (void(*)(void)) main_manager, 0, NULL, NULL);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:38:6: note: declared here
void makecontext(ucontext_t *, void (*)(), int, ...) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘THREAD_CREATE’:
uthread.c:138:3: warning: ‘makecontext’ is deprecated [-Wdeprecated-declarations]
makecontext(&newThread->context, (void(*)(void)) thread_manager, 2, func, arg);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:38:6: note: declared here
void makecontext(ucontext_t *, void (*)(), int, ...) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c:143:3: warning: ‘getcontext’ is deprecated [-Wdeprecated-declarations]
getcontext(&mainThread->context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:37:6: note: declared here
int getcontext(ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c:157:3: warning: ‘getcontext’ is deprecated [-Wdeprecated-declarations]
getcontext(&newThread->context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:37:6: note: declared here
int getcontext(ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c:169:3: warning: ‘makecontext’ is deprecated [-Wdeprecated-declarations]
makecontext(&newThread->context, (void(*)(void)) thread_manager, 2, func, arg);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:38:6: note: declared here
void makecontext(ucontext_t *, void (*)(), int, ...) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c:172:3: warning: ‘swapcontext’ is deprecated [-Wdeprecated-declarations]
swapcontext(¤tThread->context,&scheduler_context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:40:6: note: declared here
int swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘THREAD_EXIT’:
uthread.c:209:2: warning: ‘setcontext’ is deprecated [-Wdeprecated-declarations]
setcontext(&scheduler_context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:39:6: note: declared here
int setcontext(const ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c: In function ‘THREAD_YIELD’:
uthread.c:217:5: warning: ‘getcontext’ is deprecated [-Wdeprecated-declarations]
getcontext(¤tThread->context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:37:6: note: declared here
int getcontext(ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
uthread.c:221:9: warning: ‘setcontext’ is deprecated [-Wdeprecated-declarations]
setcontext(&scheduler_context);
^
In file included from uthread.h:8:0,
from uthread.c:1:
/usr/include/ucontext.h:39:6: note: declared here
int setcontext(const ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^
最佳答案
On MAC OS, you should replace
ucontext.h
withsys/ucontext.h
? Also, it seems you need to do same thing with many packages.
没有;你不应该替换 <ucontext.h>
与 <sys/ucontext.h>
; macOS 手册非常清楚,您应该使用 #include <ucontext.h>
违背这一点将会导致问题。
您使用什么编译选项?
header 包含#ifdef _XOPEN_SOURCE
然后定义函数,但还有一个 #else
条款说
#error The deprecated ucontext routines require _XOPEN_SOURCE to be defined
因此,在 macOS 上,最好不要使用这些函数,但不要使用 swapcontext()
的标题或手册页。说首选的替代方案是什么(假设有替代方案),这很令人恼火。如果您确实想使用 ucontext
功能,必须保证_XOPEN_SOURCE
是在编译时定义的。您可以直接在命令行上或通过 header 执行此操作。 (我使用自己的 header posixver.h
来完成该任务;您可以在目录 https://github.com/jleffler/soq/tree/master/src/libsoq 中找到它的副本。)
Compiling with
-D_XOPEN_SOURCE
now gives warnings about the function being deprecated — what can I do about that?
该函数已被标记为已弃用,并且在使用它时会收到警告,因为它已已弃用 - 但该函数现在已声明。如果您不想要弃用警告,请添加 -Wno-deprecated-declarations
到编译器选项。或者重写代码以使用其他机制来管理您正在使用 swapcontext()
所做的任何事情。 。
请注意,编译器会告诉您哪个选项触发了警告,以便您可以抑制它,如 no-
所示。字首。您还可以使用-Werror=deprecated-declarations
强制其成为错误而不是警告。如果编译器不包含消息中那样的标志名称,您可能无法抑制警告或错误。
关于c - Mac OS 上函数 ‘swapcontext’ 的隐式声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41752086/
在几个 SO 的问题中,有这些行可以访问代码的父目录,例如os.path.join(os.path.dirname(__file__)) returns nothing和 os.path.join(o
我想用 Python 更改文件模式。 os 模块具有三个功能上看似相同的功能: os.chmod os.fchmod os.lchmod 这三个版本有什么区别? 最佳答案 chmod 用于更改路径指定
考虑: pipe_read, pipe_write = os.pipe() 现在,我想知道两件事: (1) 我有两个线程。如果我保证只有一个正在读取 os.read(pipe_read,n) 而另一个
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
让我们以硬盘驱动器/网络接口(interface)为例。它由多个进程共享。现在多个进程可能会向硬盘驱动器发出并发命令来读取数据。当数据可用时,内核如何知道哪个进程的数据已准备好?操作系统和硬盘驱动器之
嗨,我正在尝试编写像这样的原子写入函数...... with tempfile.NamedTemporaryFile(mode= "w", dir= target_directory) as f:
net.Conn接口(interface)提供了 SetTimeout 方法,我应该用 os.Timeout 检查返回的错误.但是我看不到在返回的 os.Error 上调用 os.Timeout 的方
我正在使用 os 模块在我的 Django 项目 settings.py 文件中具有相对路径。变量 SITE_ROOT 设置为 settings.py 文件的当前工作目录,然后用于引用同样位于同一目录
正如我们所知,Windows 接受 "\" 和 "/" 作为分隔符。但是在python中,使用的是"\"。例如,调用 os.path.join("foo","bar"),将返回 'foo\\bar'。
我有以下工作目录:/Users/jordan/Coding/Employer/code_base ,我想要获取绝对路径的文件位于 /Users/jordan/Coding/Employer/code_
在 Python 中,如果路径中包含“~”,我能否确定扩展的用户调用将是绝对路径? 例如,这个表达式是否总是为真? path = '~/.my_app' os.path.expanduser(path
我是 Django 项目的初学者。Django 项目的 settings.py 文件包含这两行: BASE_DIR = os.path.dirname(os.path.dirname(os.path.
我有一个旧 MAC OS 文件存储中的文件集合。我知道集合存在文件名/路径名问题。问题源于我认为在原始操作系统中呈现为破折号的路径中包含一个代码点,但 Windows 与代码点斗争,并且其中一个包含
Ubuntu怎么安装mac os x主题呢?下文小编将为大家分享ubuntu14.04安装mac os x主题教程,安装MAC OS X&
我有一个 Firefox OS 应用程序,我希望在该应用程序之外打开一个链接(该链接指向不同的站点,在应用程序中打开它会使应用程序在没有强制的情况下无法使用)。我怎么做? Related bug re
我想为 Firefox OS 编写我的应用程序.使用什么样的语言(如 Android 的 Java 和 iOS 的 Objective C++)和工具(如 Eclipse、Xcode)? 最佳答案 适
我正在尝试创建一个 Palm OS 应用程序,以每 X 分钟或几小时检查一次网站,并在有数据可用时提供通知。我知道这种事情可以在新的 Palm 上完成——例如,当应用程序不在顶部时,我的 Centro
我需要在 Firefox OS 中显示全屏图像。我有一个具有 qHD 分辨率(960x540 像素)的“峰值”开发预览手机。 如何确保我的应用程序在其他具有不同屏幕分辨率的 firefox-os 设备
我正在尝试在 Firefox OS 中安装一个新的语言环境,但我不确定我是否正确地按照这些步骤操作。 首先,我尝试使用 Mercurial 下载所需的语言环境:它对我不起作用,Mercurial 说访
我有这个shell脚本Test.sh: #! /bin/bash FILE_TO_CHECK="/Users/test/start.txt" EXIT=0 while [ $EXIT -eq 0 ];
我是一名优秀的程序员,十分优秀!