전처리기 관련 문법적으로 맞는가요 ?

rootuser7의 이미지

커널 소스를 보다가, 이상한 것이 있어서 문의드립니다.
아래는 임베디드 시스템(Processor가 인텔의 PXA255)의 Source중에서
linux/drivers/video/pxafb.h파일에 있는 내용의 일부입니다.

그런데, 아래에서 “#elif CONFIG_FB_PXA_16BPP”라는 표현이 맞는지요 ?

제가 생각하기에는…”#elif defined (CONFIG_FB_PXA_16BPP)”으로 해줘야 맞을 것 같습니다.

실제로, 아래에 있는 예제 데로 간단하게 VC++에서 TEST 프로그램을 짜서 실행하면, Error가 발생하고,
제가 한 방법(#elif defined (CONFIG_FB_PXA_16BPP)”데로 하면 Error가 발생하지 않습니다.

그런데, linux kernel과 같은 소스에 이런 사소한 error이 있을 리는 없고 한데요…
정말 무엇이 맞는지요 ?

========아래==================
#ifdef CONFIG_FB_PXA_8BPP
# define PXAFB_BPP 8
# define PXAFB_BPP_BITS 0x03
#elif CONFIG_FB_PXA_16BPP
# define PXAFB_BPP 16
# define PXAFB_BPP_BITS 0x04
#endif

익명 사용자의 이미지

CONFIG_FB_PXA_16BPP 가 0이 아닌 숫자값을 가지면 #elif 아래부분이 적용되는 듯 합니다.

wsmrdo의 이미지

1. #elif defined (CONFIG_FB_PXA_16BPP) <-- CONFIG_FB_PXA_16BPP 이 선언되었는가에 따른

2. #elif CONFIG_FB_PXA_16BPP <-- CONFIG_FB_PXA_16BPP 의 값이 무엇이냐에 따른

결론적으로.. 1번은 선언이 되었는가 아닌가 이고..
2번은 값이 무엇인가 입니다.

1,번은 선언이 안되었으면 조건 불만족으로 안되지만.
2번은 선언 안되어 있으면 에러 이겠죠. 조건 자체가 없으니.

2번을 만족 시키시려면.(컴파일 에러가 안생기려면)
앞쪽에..
#define CONFIG_FB_PXA_16BPP 1
혹은
#define CONFIG_FB_PXA_16BPP 0
를 선언해 주셔서.. 써야 할거 같습니다만.

테스트 안해 봐서요... 자세한 사항은 해봐야 알겠습니다. ^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.