免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4251 | 回复: 2
打印 上一主题 下一主题

如何判断编译时glibc中某个宏在哪里定义的? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-19 11:13 |只看该作者 |倒序浏览
我在编译native u-boot的时候,碰到vdprintf没有定义的问题,后来发现是因为宏__USE_XOPEN2K8没有打开的原因,但是这个宏只在glibc中使用了,u-boot并没有使用它,而且应不应该去使用它。如果使用交叉编译器没有这样的问题,__USE_XOPEN2K8似乎被定义了。那么我如何检查这个宏到底是在哪里定义的呢?gcc会传递一些缺省宏吧?glibc也有一些宏是打开的。有没有办法可以列出编译过程中哪些宏被打开了?

论坛徽章:
0
2 [报告]
发表于 2010-03-19 14:51 |只看该作者

  1. [root@mail ~/gcc-3.0/build/gcc]# cat 1.c
  2. #define A 1
  3. #undef A

  4. [root@mail ~/gcc-3.0/build/gcc]# gcc -E -dD 1.c
  5. # 1 "1.c"
  6. # 1 "<built-in>"
  7. #define __VERSION__ "3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
  8. #define __USER_LABEL_PREFIX__
  9. #define __REGISTER_PREFIX__
  10. #define __HAVE_BUILTIN_SETJMP__ 1
  11. #define __SIZE_TYPE__ unsigned int
  12. #define __PTRDIFF_TYPE__ int
  13. #define __WCHAR_TYPE__ long int
  14. #define __WINT_TYPE__ unsigned int
  15. #define __STDC__ 1
  16. # 1 "<command line>"
  17. #define __GNUC__ 3
  18. # 1 "<command line>"
  19. #define __GNUC_MINOR__ 2
  20. # 1 "<command line>"
  21. #define __GNUC_PATCHLEVEL__ 2
  22. # 1 "<command line>"
  23. #define __GXX_ABI_VERSION 102
  24. # 1 "<command line>"
  25. #define __ELF__ 1
  26. # 1 "<command line>"
  27. #define unix 1
  28. # 1 "<command line>"
  29. #define __gnu_linux__ 1
  30. # 1 "<command line>"
  31. #define linux 1
  32. # 1 "<command line>"
  33. #define __ELF__ 1
  34. # 1 "<command line>"
  35. #define __unix__ 1
  36. # 1 "<command line>"
  37. #define __gnu_linux__ 1
  38. # 1 "<command line>"
  39. #define __linux__ 1
  40. # 1 "<command line>"
  41. #define __unix 1
  42. # 1 "<command line>"
  43. #define __linux 1
  44. # 1 "<command line>"
  45. #define __NO_INLINE__ 1
  46. # 1 "<command line>"
  47. #define __STDC_HOSTED__ 1
  48. # 1 "<command line>"
  49. #define i386 1
  50. # 1 "<command line>"
  51. #define __i386 1
  52. # 1 "<command line>"
  53. #define __i386__ 1
  54. # 1 "<command line>"
  55. #define __tune_i386__ 1
  56. # 1 "1.c"
  57. #define A 1
  58. #undef A
  59. [root@mail ~/gcc-3.0/build/gcc]# gcc -E -dM 1.c
  60. #define __HAVE_BUILTIN_SETJMP__ 1
  61. #define __unix__ 1
  62. #define unix 1
  63. #define __i386__ 1
  64. #define __SIZE_TYPE__ unsigned int
  65. #define __ELF__ 1
  66. #define __GNUC_PATCHLEVEL__ 2
  67. #define __linux 1
  68. #define __unix 1
  69. #define __linux__ 1
  70. #define __USER_LABEL_PREFIX__
  71. #define linux 1
  72. #define __STDC_HOSTED__ 1
  73. #define __WCHAR_TYPE__ long int
  74. #define __gnu_linux__ 1
  75. #define __WINT_TYPE__ unsigned int
  76. #define __GNUC__ 3
  77. #define __GXX_ABI_VERSION 102
  78. #define i386 1
  79. #define __GNUC_MINOR__ 2
  80. #define __STDC__ 1
  81. #define __PTRDIFF_TYPE__ int
  82. #define __tune_i386__ 1
  83. #define __REGISTER_PREFIX__
  84. #define __NO_INLINE__ 1
  85. #define __i386 1
  86. #define __VERSION__ "3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
复制代码

论坛徽章:
0
3 [报告]
发表于 2010-03-24 16:13 |只看该作者
谢谢,真得很有用
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP