cppComplexExpr.vert 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. #version 300 es
  2. #define ON1
  3. #define ON2
  4. float sum = 0.0;
  5. void main()
  6. {
  7. #if defined(ON1) && (defined(OFF) || defined(ON2))
  8. //yes
  9. sum += 1.0;
  10. #endif
  11. #if !defined(ON1) || (defined(OFF) || (!defined(OFF2) && defined(ON2)))
  12. //yes
  13. sum += 20.0;
  14. #endif
  15. #if defined(ON1) && (defined(OFF) || !defined(ON2))
  16. //no
  17. sum += 0.1;
  18. #endif
  19. #if !defined(ON1) || (defined(OFF) || !defined(OFF2) && !defined(ON2))
  20. //no
  21. sum += 0.2;
  22. #endif
  23. #if !defined(ON1) || !defined(OFF) || defined(ON2) && defined(OFF2)
  24. //yes
  25. sum += 300.0;
  26. #endif
  27. #if (!defined(ON1) || !defined(OFF) || defined(ON2)) && defined(OFF2)
  28. //no
  29. sum += 0.4;
  30. #endif
  31. // sum should be 321.0
  32. gl_Position = vec4(sum);
  33. }
  34. #define ADD(a, b) a + b + ((a) + ((b)));
  35. float foo()
  36. {
  37. return ADD(gl_Position.xyxwx, 3.0) // ERROR, should be this line number
  38. return ADD(gl_Position.y, 3.0)
  39. }
  40. #define BIG aonetuhanoethuanoenaoethu snaoetuhs onethausoentuas hnoethaueohnatuoeh santuoehsantouhe snathoensuta hsnoethuasntoe hsnuathoesnuathoenstuh nsoethantseuh toae ua \
  41. antoeh uantheount oentahoent uahnsoethasnutoehansteuo santhu sneoathu snoethasnut oesanthoesna thusenotha nsthasunoeth ausntehsunathoensuathoesnta uhnsoetha usntoeh uanhs unosethu \
  42. antoehunatoehu natoehua oentha neotuhan toehu natoehu ntahoe nutah eu natoheunathoen uasoenuasoent asntoehsan tuosnthnu aohenuath eontha untoh eunth unth anth unth nth nth nt \
  43. a ntoehanu tunth nsont uhansoethausn oehsanthnt heauo eanthuo sh nahnoethansu tohe sanuthoe snathuoesntha snuothe anthusonehtasuntoeh asnuthonsa teauhntoeha onetuha nth \
  44. anoethuan toentauh noethauntohe anuthoe nathu noethaun oethanuthoe nathuoe ntahu enotha unetha ntuhenaothu enotahun eotha ntoehu aoehuntha enotuh aonethau noethu anoethuna toheua \
  45. ontehanutoe hnuathoena aoteha aonetuha
  46. // identical
  47. #define BIG aonetuhanoethuanoenaoethu snaoetuhs onethausoentuas hnoethaueohnatuoeh santuoehsantouhe snathoensuta hsnoethuasntoe hsnuathoesnuathoenstuh nsoethantseuh toae ua \
  48. antoeh uantheount oentahoent uahnsoethasnutoehansteuo santhu sneoathu snoethasnut oesanthoesna thusenotha nsthasunoeth ausntehsunathoensuathoesnta uhnsoetha usntoeh uanhs unosethu \
  49. antoehunatoehu natoehua oentha neotuhan toehu natoehu ntahoe nutah eu natoheunathoen uasoenuasoent asntoehsan tuosnthnu aohenuath eontha untoh eunth unth anth unth nth nth nt \
  50. a ntoehanu tunth nsont uhansoethausn oehsanthnt heauo eanthuo sh nahnoethansu tohe sanuthoe snathuoesntha snuothe anthusonehtasuntoeh asnuthonsa teauhntoeha onetuha nth \
  51. anoethuan toentauh noethauntohe anuthoe nathu noethaun oethanuthoe nathuoe ntahu enotha unetha ntuhenaothu enotahun eotha ntoehu aoehuntha enotuh aonethau noethu anoethuna toheua \
  52. ontehanutoe hnuathoena aoteha aonetuha
  53. // ERROR, one character different
  54. #define BIG aonetuhanoethuanoenaoethu snaoetuhs onethausoentuas hnoethaueohnatuoeh santuoehsantouhe snathoensuta hsnoethuasntoe hsnuathoesnuathoenstuh nsoethantseuh toae ua \
  55. antoeh uantheount oentahoent uahnsoethasnutoehansteuo santhu sneoathu snoethasnut oesanthoesna thusenotha nsthasunoeth ausntehsunathoensuathoesnta uhnsoetha usntoeh uanhs unosethu \
  56. antoehunatoehu natoehua oentha neotuhan toehu natoehu ntahoe nutah eu natoheunathoen uasoenuasoent asntoehsan tuosnthnu aohenuath eontha untoh eunth unth anth unth nth nth nt \
  57. a ntoehanu tunth nsont uhansoethasn oehsanthnt heauo eanthuo sh nahnoethansu tohe sanuthoe snathuoesntha snuothe anthusonehtasuntoeh asnuthonsa teauhntoeha onetuha nth \
  58. anoethuan toentauh noethauntohe anuthoe nathu noethaun oethanuthoe nathuoe ntahu enotha unetha ntuhenaothu enotahun eotha ntoehu aoehuntha enotuh aonethau noethu anoethuna toheua \
  59. ontehanutoe hnuathoena aoteha aonetuha
  60. #define BIGARGS1(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
  61. #define BIGARGS2(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
  62. #define BIGARGS3(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
  63. #define BIGARGS4(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
  64. #define foobar(a, b) a + b
  65. #if foobar(1.1, 2.2)
  66. #error good macro
  67. #else
  68. #error bad macro
  69. #endif
  70. #if foobar(1
  71. ;
  72. #
  73. #
  74. #endif
  75. #if foobar(1,
  76. ;
  77. #
  78. #
  79. #endif
  80. float c = foobar(1.1, 2.2
  81. );
  82. #if foobar(1.1, 2.2
  83. )
  84. #if foobar(1.1, 2.2
  85. #endif
  86. #endif
  87. #define VAL0 0
  88. #define VAL1 1
  89. #if UNDEF
  90. #error bad 0
  91. #else
  92. #error good 0
  93. #endif
  94. #if VAL1 || UNDEF
  95. #error good 1
  96. #else
  97. #error bad 1
  98. #endif
  99. #if VAL1 && UNDEF // UNDEF ERROR
  100. #endif
  101. #if VAL0 || UNDEF // UNDEF ERROR
  102. #endif
  103. #if VAL0 && UNDEF
  104. #error bad 2
  105. #else
  106. #error good 1
  107. #endif
  108. #if VAL1 || (VAL1 && UNDEF)
  109. #error good 3
  110. #else
  111. #error bad 3
  112. #endif
  113. #if VAL1 && (VAL1 || UNDEF)
  114. #error good 4
  115. #else
  116. #error bad 4
  117. #endif
  118. #if VAL1 < VAL1 || VAL1 > VAL1 || UNDEF // UNDEF ERROR
  119. #endif
  120. #if VAL1 < VAL1 || VAL1 > VAL1 && UNDEF
  121. #endif
  122. #if VAL1 || UNDEF && UNDEF2
  123. #endif
  124. #if VAL0 || UNDEF && UNDEF2 // UNDEF ERROR
  125. #endif
  126. #if (VAL1 || UNDEF) && UNDEF2 // UNDEF2 ERROR
  127. #endif
  128. #if (VAL0 && UNDEF) || UNDEF2 // UNDEF2 ERROR
  129. #endif
  130. #line 3000
  131. #error line of this error should be 3000
  132. #define __LINE__ 30
  133. #define __FILE__
  134. #define __VERSION__
  135. #define GL_SOME_EXTENSION
  136. #undef __LINE__
  137. #undef __FILE__
  138. #undef __VERSION__
  139. #undef GL_SOME_EXTENSION
  140. #line 4000
  141. #line 200 % 0 // ERROR, div by 0
  142. #if __LINE__ / 0 // ERROR, div by 0
  143. #endif
  144. #if 7% // ERROR incomplete expression
  145. #line 10000
  146. #if 0
  147. // ERROR, EOF